lua: add flex array field to TString type #16583
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Silence kernel warnings from the Lua module:
Closes #16541.
Description
Linux 6.10+ with CONFIG_FORTIFY_SOURCE notices
memcpy()
accessing past the end ofTString
, because it has no indication that there there may be an additional allocation there.There's no appropriate upstream change for this (ancient) version of Lua, so this is the narrowest change I could come up with to add a flex array field to the end of
TString
to satisfy the check. It's loosely based on changes from lua/lua@ca41b43f and lua/lua@9514abc2.How Has This Been Tested?
Ran
lua_core
test tag on 6.1.102 and 6.11.0 with and without this patch. All tests passed in all cases, 6.11.0 without this patch produced the above warning. With patch, silence.Also compiled and ran
lua_core
on 14.1-RELEASE-p3, all successful.Types of changes
Checklist:
Signed-off-by
.