From 9b3aab6c0d59ce15c67f03bc6368556f93d052d0 Mon Sep 17 00:00:00 2001 From: Peter Westwood 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: https://develop.svn.wordpress.org/trunk@7314 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 d387f00d44..b490744448 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)