com php-src: Check non-zero in is_power_of_two(): ext/opcache/jit/zend_jit_x86.dasc

From: Date: Thu, 30 Jul 2020 08:17:37 +0000
Subject: com php-src: Check non-zero in is_power_of_two(): ext/opcache/jit/zend_jit_x86.dasc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-112454@lists.php.net to get a copy of this message
Commit: 3690a805c15087f7f04c602e9f3c1e617060c475 Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 30 Jul 2020 10:17:37 +0200 Parents: 849c7415b5ee42a2a56be62404bf9fb07a5a630d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3690a805c15087f7f04c602e9f3c1e617060c475 Log: Check non-zero in is_power_of_two() And assert non-zero in floor_log2(). Fixes DASM_S_RANGE_I in ext/simplexml/tests/021.phpt. Changed paths: M ext/opcache/jit/zend_jit_x86.dasc Diff: diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 5c827f4b99..107e2c5de8 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -1613,6 +1613,7 @@ static uint32_t ones32(uint32_t x) static uint32_t floor_log2(uint32_t x) { + ZEND_ASSERT(x != 0); x |= (x >> 1); x |= (x >> 2); x |= (x >> 4); @@ -1623,7 +1624,7 @@ static uint32_t floor_log2(uint32_t x) static zend_bool is_power_of_two(uint32_t x) { - return !(x & (x - 1)); + return !(x & (x - 1)) && x != 0; } static zend_bool has_concrete_type(uint32_t value_type)

« previous php.cvs (#112454) next »