Chase down some 64bit dragons. Ensure that we only ever create a 32bit number to compare to the 32bit magic number when searching a zip file for the end of the directory record. See #6236.

git-svn-id: http://svn.automattic.com/wordpress/trunk@7314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2008-03-15 18:33:16 +00:00
parent 8734e3d1bf
commit f9871ae531
1 changed files with 3 additions and 1 deletions

View File

@ -4470,7 +4470,9 @@
$v_byte = @fread($this->zip_fd, 1);
// ----- Add the byte
$v_bytes = ($v_bytes << 8) | Ord($v_byte);
// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
// Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
$v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
// ----- Compare the bytes
if ($v_bytes == 0x504b0506)