Bug #67024 [NEW]: getimagesize should recognize BMP files with negative height

From: Date: Fri, 04 Apr 2014 22:14:55 +0000
Subject: Bug #67024 [NEW]: getimagesize should recognize BMP files with negative height
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185094@lists.php.net to get a copy of this message
From: gbuella at gmail dot com Operating system: PHP version: master-Git-2014-04-04 (Git) Package: GetImageSize related Bug Type: Bug Bug description:getimagesize should recognize BMP files with negative height Description: ------------ The functions getimagesize, and getimagesizefromstring treat the height field of a BITMAPINFOHEADER header as an unsigned integer, while it really is a signed integer. On platforms with 64 bit PHP integers, this results in height being reported as 4294966272 for an image with height -1024, instead of the expected result height=1024. Test script: --------------- <?php $image_data = "Qk06AAAAAAAAADYAAAAoAAAAAQAAAP////8BABgAAAAAAAQAAADDDgAAww4AAAAAAAAAAAAA////AA=="; var_dump(getimagesizefromstring(base64_decode($image_data))); ?> Expected result: ---------------- array(6) { [0]=> int(1) [1]=> int(1) [2]=> int(6) [3]=> string(20) "width="1" height="1"" ["bits"]=> int(24) ["mime"]=> string(14) "image/x-ms-bmp" } Actual result: -------------- array(6) { [0]=> int(1) [1]=> int(4294967295) [2]=> int(6) [3]=> string(21) "width="1" height="-1"" ["bits"]=> int(24) ["mime"]=> string(14) "image/x-ms-bmp" } -- Edit bug report at https://bugs.php.net/bug.php?id=67024&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67024&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67024&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67024&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=67024&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=67024&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=67024&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=67024&r=needscript Try newer version: https://bugs.php.net/fix.php?id=67024&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=67024&r=support Expected behavior: https://bugs.php.net/fix.php?id=67024&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=67024&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=67024&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=67024&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67024&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=67024&r=dst IIS Stability: https://bugs.php.net/fix.php?id=67024&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=67024&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=67024&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=67024&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=67024&r=mysqlcfg

« previous php.bugs (#185094) next »