From f9871ae53102fd37b3b43ea8647049b52e63f11f Mon Sep 17 00:00:00 2001 From: westi Date: Sat, 15 Mar 2008 18:33:16 +0000 Subject: [PATCH] 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 --- wp-admin/includes/class-pclzip.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-pclzip.php b/wp-admin/includes/class-pclzip.php index d387f00d4..b49074444 100644 --- a/wp-admin/includes/class-pclzip.php +++ b/wp-admin/includes/class-pclzip.php @@ -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)