[php-src] PR #17666: Fix fallback paths in fast_long_{add,sub}_function
| From: | nielsdos | Date: | Sun, 02 Feb 2025 00:07:01 +0000 |
| Subject: | [php-src] PR #17666: Fix fallback paths in fast_long_{add,sub}_function | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30626@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17666
Author: nielsdos
This was asked to be checked in https://github.com/php/php-src/pull/17472#issuecomment-2591325036
There are 3 issues:
1) The constant LONG_SIGN_MASK is wrong. Commit 98df5c97 changed this to
avoid UB but did this incorrectly. The right fix was using
zend_ulong.
2) The UB in the if can overflow, and can be fixed by using zend_ulong
for the sum/sub.
3) fast_long_sub_function() has a problem when result aliases.
This is fixed in the same way as fast_long_add_function() works.