|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-07-12 17:16 UTC] cmb@php.net
[2015-07-12 23:00 UTC] p at wspnr dot com
[2015-07-13 08:45 UTC] cmb@php.net
[2015-07-13 11:45 UTC] p at wspnr dot com
[2015-07-13 12:18 UTC] cmb@php.net
[2015-07-13 12:40 UTC] p at wspnr dot com
[2015-07-23 14:48 UTC] cmb@php.net
-Status: Open
+Status: Analyzed
-Assigned To:
+Assigned To: cmb
[2015-07-23 16:05 UTC] cmb@php.net
-Summary: getimagesize() + WBMP integer overflow
+Summary: getimagesize() fails for very large and very small
WBMP
[2015-07-23 16:46 UTC] cmb@php.net
[2015-07-23 16:46 UTC] cmb@php.net
-Status: Analyzed
+Status: Closed
[2015-07-23 21:16 UTC] p at wspnr dot com
[2015-07-23 22:01 UTC] cmb@php.net
[2015-08-04 20:54 UTC] ab@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Jan 08 16:00:02 2026 UTC |
Description: ------------ 1. getimagesize() seems to artificially limit the size of valid WBMPs to 2048x2048, even though imagecreatefromwbmp() will happily load WBMPs of arbitrary dimensions. 2. There is an integer overflow bug that occurs when the size of the supplied WBMP, as indicated in the header, is greater than (2^31-1) resulting in invalid WBMPs returning a "valid" response. This may cause problems for scripts that use getimagesize() to detect whether a file is an image or not. Test script: --------------- -- WBMP 1, 2047x2047 -- 00 00 80 80 80 8F 7F 80 80 80 8F 7F -- WBMP 2, 2048x2048 -- 00 00 80 80 80 90 00 80 80 80 90 00 -- WBMP 3, 2049x2049 -- 00 00 80 80 80 90 01 80 80 80 90 01 -- WBMP 4, (2^31)x(2^31) -- 00 00 88 80 80 80 00 88 80 80 80 00 -- WBMP 5, (2^32-1)x(2^32-1) -- 00 00 8F FF FF FF 7F 8F FF FF FF 7F -- PHP -- <?php for($i = 1; $i <= 5); ++$i) { echo "WBMP ", $i, PHP_EOL; var_dump(getimagesize("wbmp" . $i . ".wbmp")); } Expected result: ---------------- WBMP 1 array(5) { [0]=> int(2047) [1]=> int(2047) [2]=> int(15) [3]=> string(26) "width="2047" height="2047"" ["mime"]=> string(18) "image/vnd.wap.wbmp" } WBMP 2 array(5) { [0]=> int(2048) [1]=> int(2048) [2]=> int(15) [3]=> string(26) "width="2048" height="2048"" ["mime"]=> string(18) "image/vnd.wap.wbmp" } WBMP 3 bool(false) WBMP 4 bool(false) WBMP 5 bool(false) Actual result: -------------- WBMP 1 array(5) { [0]=> int(2047) [1]=> int(2047) [2]=> int(15) [3]=> string(26) "width="2047" height="2047"" ["mime"]=> string(18) "image/vnd.wap.wbmp" } WBMP 2 array(5) { [0]=> int(2048) [1]=> int(2048) [2]=> int(15) [3]=> string(26) "width="2048" height="2048"" ["mime"]=> string(18) "image/vnd.wap.wbmp" } WBMP 3 bool(false) WBMP 4 array(5) { [0]=> int(2147483648) [1]=> int(2147483648) [2]=> int(15) [3]=> string(40) "width="-2147483648" height="-2147483648"" ["mime"]=> string(18) "image/vnd.wap.wbmp" } WBMP 5 array(5) { [0]=> int(4294967295) [1]=> int(4294967295) [2]=> int(15) [3]=> string(22) "width="-1" height="-1"" ["mime"]=> string(18) "image/vnd.wap.wbmp" }