1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

nvdisc.c: Fix crash after an error or signal in discipline function (#356)

This patch fixes the crashes experienced when a discipline function
exited because of a signal or an error from a special builtin. The
crashes were caused by ksh entering an inconsistent state after
performing a longjmp away from the assign() and lookup() functions in
nvdisc.c. Fixing the crash requires entering a new context, then setting
a nonlocal goto with sigsetjmp(3). Any longjmps that happen while
running the discipline function will go back to assign/lookup, allowing
ksh to do a proper cleanup afterwards.

Resolves: https://github.com/ksh93/ksh/issues/346
This commit is contained in:
Johnothan King 2021-12-01 20:43:41 -08:00 committed by Martijn Dekker
parent 520f530198
commit 0a343244c1
3 changed files with 21 additions and 5 deletions

6
NEWS
View file

@ -3,6 +3,12 @@ For full details, see the git log at: https://github.com/ksh93/ksh
Any uppercase BUG_* names are modernish shell bug IDs.
2021-12-01:
- Fixed a memory fault that occurred when a discipline function exited
with an error from a special builtin or when a discipline function exited
because of a signal.
2021-11-29:
- Fixed a memory fault that prevented ksh from functioning on ARM-based Macs.