fix integer overflow in WIFSTOPPED macro
authorRich Felker <dalias@aerifal.cx>
Thu, 19 Jan 2023 04:15:58 +0000 (23:15 -0500)
committerRich Felker <dalias@aerifal.cx>
Wed, 8 Feb 2023 21:42:28 +0000 (16:42 -0500)
commitea3b40a321e751e016948087ef23ae7b9e8e0150
treef4c353f26002191d8cfdb80e77aa1491773f4622
parentf897461d4fe72bb71854a6d0662de83008caccb7
fix integer overflow in WIFSTOPPED macro

the result of the 0xffff mask with the exit status could have bit 15
set, in which case multiplying by 0x10001 overflows 32-bit signed int.
making the multiply unsigned avoids the overflow. it also changes the
sign extension behavior of the subsequent >> operation, but the
affected bits are all unwanted anyway and all discarded by the cast to
short.
include/stdlib.h
include/sys/wait.h