From:             php_bug at cklowe dot com 
Operating system: Win32
PHP version:      4CVS-2004-11-05 (stable)
PHP Bug Type:     Math related
Bug description:  0x80000000 treated as 0x7fffffff

Description:
------------
Large integers are being saturated to the maximum signed value
(0x7fffffff) as opposed to being treated as the unsigned values.  

Panic!  I had code that set the high bit in a Permissions variable when
some condition was met.  

After changing PHP versions because of bug 25570, I found user reports of
"Why have I got all these additional permissions?" and "I've now got Admin
rights, OOoooh.  What happens if I run this SQL query in the page I now
have access to?".

Reproduce code:
---------------
define ("BIG_NUM", 0x80000000);
$big_var = 0x80000000;
echo sprintf("%08x, %08x", BIG_NUM, $big_var);


Expected result:
----------------
80000000,80000000

Actual result:
--------------
7fffffff, 7fffffff

-- 
Edit bug report at http://bugs.php.net/?id=30695&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30695&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30695&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30695&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30695&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30695&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30695&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30695&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30695&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30695&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30695&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30695&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30695&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30695&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30695&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30695&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30695&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30695&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30695&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30695&r=mysqlcfg

Reply via email to