php-src/sapi
Niels Dossche dd3aa18545
Fix incorrect check in fpm_shm_free() (#13797)
`if (fpm_shm_size - size > 0)` will be rewritten by the compiler as this: `if (fpm_shm_size != size)`, which is undesirable. The reason this happens is that both variables are size_t, so subtracting them cannot be negative. The only way it can be not > 0, is if they're equal because the result will then be 0. This means that the else branch won't work properly. E.g. if `fpm_shm_size == 50` and `size == 51`, then `fpm_shm_size` will wraparound instead of becoming zero.

To showcase that the compiler actually does this, take a look at this
isolated case: https://godbolt.org/z/azobdWcrY. Here we can see the
usage of the compare instruction + cmove, so the "then" branch
is only done if the variables are equal.
2024-03-24 13:57:08 +01:00
..
apache2handler Merge branch 'PHP-8.1' into PHP-8.2 2022-12-13 15:24:07 +01:00
cgi Set libtool tag per command instead of global one 2024-01-10 09:09:45 +01:00
cli Set libtool tag per command instead of global one 2024-01-10 09:09:45 +01:00
embed Refacto php_module_startup() (#8303) 2022-04-27 23:07:11 +01:00
fpm Fix incorrect check in fpm_shm_free() (#13797) 2024-03-24 13:57:08 +01:00
fuzzer Wrap cleanup function call with zend_try. 2024-01-22 10:32:04 +03:00
litespeed Set libtool tag per command instead of global one 2024-01-10 09:09:45 +01:00
phpdbg Use getenv to prevent undefined key warning 2024-01-15 20:15:04 +01:00