Bug #68672 [Opn]: incorrect bit shift

From: Date: Tue, 30 Dec 2014 02:52:11 +0000
Subject: Bug #68672 [Opn]: incorrect bit shift
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189320@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68672&edit=1 ID: 68672 Updated by: aharvey@php.net Reported by: bugreports at internot dot info Summary: incorrect bit shift Status: Open Type: Bug -Package: *General Issues +Package: Scripting Engine problem Operating System: Linux Ubuntu 14.04 PHP Version: master-Git-2014-12-28 (Git) Block user comment: N Private report: N New Comment: The shifts in the comments look OK to me (they're explicitly 64 bit integers, and the shift is 61 in both cases), but the zend_strtod.c shift definitely looks like it could be problematic, as lo0bits() can return 32 and ULong (which is the type of z) is a typedef for uint32_t. Previous Comments: ------------------------------------------------------------------------ [2014-12-28 23:01:47] bugreports at internot dot info Aswell as: 958 context->count[1] += ((php_hash_uint64) inputLen >> 61); ------------------------------------------------------------------------ [2014-12-28 23:01:08] bugreports at internot dot info And /ext/hash/hash_sha.c: 844 context->count[1] += ((php_hash_uint64) inputLen >> 61); Thanks, ------------------------------------------------------------------------ [2014-12-28 22:56:42] bugreports at internot dot info Description: ------------ Hi, In /Zend/zend_strtod.c: 1137 z >>= k; But k may be 32. Bitshifting >=32 causes "undefined behavior". Thanks, ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68672&edit=1

« previous php.bugs (#189320) next »