-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parse.c: fix use-after-free probs related to funstaks()
When the funstaks() function deletes a stack, other code could still reference that stack's pointer, at least if a script's DEBUG trap changed the function context by assigning to ${.sh.level}. This crashed @ormaaj's funcname.ksh script in certain contexts, at least when run as a dot script or in a virtual subshell. This allows that script to run in all contexts by making funstaks(s) set the stack pointer to NULL after deleting the stack and making various other points in the code check for a null pointer before dereferencing it. This may not be the most elegant fix but (in my testing) it does work, even when compiling ksh with AddressSanitiser. Thanks to @JohnoKing for help researching this problem. Resolves: #212
- Loading branch information
Showing
4 changed files
with
125 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters