chiark / gitweb /
math/mpx.c (mpx_lsr): Fix pointer out-of-bounds bug.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 22 Jun 2018 11:45:22 +0000 (12:45 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 22 Jun 2018 11:45:22 +0000 (12:45 +0100)
commit85e29c6edea1042eafbb8345ba0a7d805fa9b4bd
tree8d6e18d928dc1be896afb7d22748c49c1df09b69
parentf72de1ee756e59988c9c9bb49df42f513aa9dca1
math/mpx.c (mpx_lsr): Fix pointer out-of-bounds bug.

If `n' is huge, and `av' is near the top of memory (e.g., in the top
quarter, if we're using 32-bit digits) then `av + n' wraps around, and
is consequently less than `avl', leading to all sorts of unfortunate
behaviour.

Noticed under `qemu-arm' on stretch, but generally applicable.
math/mpx.c