Backport ksh93v- bugfix for the crash in types.sh #812
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.
This commit backports a bugfix from ksh93v- 2012-08-24 for a possible crash at the first
strncmp
increate_type()
. This crash will occur if the size and/or alignment of theNamval_t
struct is changed (i.e., ifnp->nvsize
ornp->nvflag
is upgraded to a larger data type). Thus far I can't reproduce this bug on the dev branch without changing the size of theNamval_t
struct, but the root cause of the bug should be fixed nonetheless for correctness.I encountered this bug while experimenting with changing the size of
Namval_t
, which at the moment is primarily relevant to the unfinished local builtin (which needs to store a newNV_DYNAMIC
flag in the variable node'snvflag
set). Non-upstreamed commits for reference:JohnoKing@3ca5470 (local-builtin branch)
JohnoKing@798d463 (expand-nvflags branch)
JohnoKing@e390adf (earlier iteration of this commit)
Stacktrace from ASan (unlike the old one in the earlier expand-nvflags commit, this was retested against 0510264 with
np->nvsize
changed touint64_t
; it can also be reproduced ifnp->nvflags
is enlargened instead):src/cmd/ksh93/sh/nvtype.c:
NV_MINSZ
when setting thebase
string to ensure no invalid reads occur because of changes in the size ofNamval_t
.strlen
in asize_t
variable.