Repository navigation
Conversation
…erand zend_jit_trace_update_condition_ranges() tested OP1_INFO() twice instead of OP1_INFO() and OP2_INFO(), so comparing an integer with a float or numeric-string literal narrowed the integer's range as if both operands were integers. zend_may_overflow() then ruled out overflow of a following $x + 1, the overflow check was omitted, and the trace returned a wrapped integer instead of a float, or failed an assertion while compiling. Require both operands to be integers, as the rest of the function assumes.
Owner
Author
|
Promoted to php#24528. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zend_jit_trace_update_condition_ranges()testedOP1_INFO()twice where the second check should beOP2_INFO(), so comparing an integer with a float or numeric-string literal narrowed the integer's range as if both were integers. With$x < 1.0e19true forPHP_INT_MAX,$x + 1lost its overflow check and the trace returnedint(-9223372036854775808)instead offloat(9.2233720368547758E+18); debug builds instead fail theend_inputs->count == res_inputs->countassertion inzend_jit_math_helper(). The typo dates from e701146.Comparisons against float or string variables still wrap on this branch, but that is the optimizer bug phpGH-24088 (php#24110), which reproduces with the JIT disabled. The
>arm's mixed bound at line 3764 was checked; it only widens the range and has no observable effect, so it is left alone.Found while testing the phpGH-24088 fix; verified on a PHP-8.4 debug NTS build (hybrid VM) under tracing, function JIT, and with the JIT disabled.