aboutsummaryrefslogtreecommitdiff
path: root/event-loop-base.c
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2023-07-17 12:39:38 +0200
committerHelge Deller <deller@gmx.de>2023-07-18 20:42:05 +0200
commiteac78a4b0b7da4de2c0a297f4d528ca9cc6256a3 (patch)
tree31c66f7598c03a387372051a5192f2caa7b83595 /event-loop-base.c
parentdfe49864afb06e7e452a4366051697bc4fcfc1a5 (diff)
downloadqemu-eac78a4b0b7da4de2c0a297f4d528ca9cc6256a3.zip
qemu-eac78a4b0b7da4de2c0a297f4d528ca9cc6256a3.tar.gz
qemu-eac78a4b0b7da4de2c0a297f4d528ca9cc6256a3.tar.bz2
linux-user: Fix signed math overflow in brk() syscall
Fix the math overflow when calculating the new_malloc_size. new_host_brk_page and brk_page are unsigned integers. If userspace reduces the heap, new_host_brk_page is lower than brk_page which results in a huge positive number (but should actually be negative). Fix it by adding a proper check and as such make the code more readable. Signed-off-by: Helge Deller <deller@gmx.de> Tested-by: "Markus F.X.J. Oberhumer" <markus@oberhumer.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Cc: qemu-stable@nongnu.org Buglink: https://github.com/upx/upx/issues/683
Diffstat (limited to 'event-loop-base.c')
0 files changed, 0 insertions, 0 deletions