-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix undefined behavior in 'pty' and '.sh.match' (#708)
This commit fixes a few errors that occur when ksh is built with -fsanitize=address,undefined. src/lib/libast/include/proc.h: - Use long typecasts in PROC_op* macros to make the bit shifts safe. This fixes a shift overflow in the expansion of PROC_FD_CTTY(): src/cmd/builtin/pty.c:356:18: runtime error: left shift of 12 by 28 places cannot be represented in type 'int' src/cmd/ksh93/sh/init.c: - Ensure mp->nodes is not NULL before making use of it. This change fixes two errors under ASan that occur during the exit and glob regression tests: src/cmd/ksh93/sh/init.c:868:6: runtime error: applying non-zero offset 18446744073709551600 to null pointer src/cmd/ksh93/sh/init.c:831:5: runtime error: applying non-zero offset 18446744073709551600 to null pointer
- Loading branch information
Showing
2 changed files
with
38 additions
and
32 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