svn: /php/php-src/ branches/PHP_5_2/ext/gd/libgd/gd_gd.c branches/PHP_5_2/ext/gd/tests/crafted.gd2 branches/PHP_5_2/ext/gd/tests/crafted_gd2.phpt
branches/PHP_5_3/ext/gd/libgd/gd_gd.c branches/PHP_5_3/ext/gd/tests/crafted.gd2 branches/PHP_5_3/ext/gd/tests/crafted_gd2.phpt
branches/PHP_5_3_1/ext/gd/libgd/gd_gd.c branches/PHP_5_3_1/ext/gd/tests/crafted.gd2 branches/PHP_5_3_1/ext/gd/tests/crafted_gd2.phpt
trunk/ext/gd/libgd/gd_gd.c trunk/ext/gd/tests/crafted.gd2 trunk/ext/gd/tests/crafted_gd2.phpt
| From: | Pierre-Alain Joye | Date: | Mon, 12 Oct 2009 10:01:37 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_2/ext/gd/libgd/gd_gd.c branches/PHP_5_2/ext/gd/tests/crafted.gd2 branches/PHP_5_2/ext/gd/tests/crafted_gd2.phpt branches/PHP_5_3/ext/gd/libgd/gd_gd.c branches/PHP_5_3/ext/gd/tests/crafted.gd2 branches/PHP_5_3/ext/gd/tests/crafted_gd2.phpt branches/PHP_5_3_1/ext/gd/libgd/gd_gd.c branches/PHP_5_3_1/ext/gd/tests/crafted.gd2 branches/PHP_5_3_1/ext/gd/tests/crafted_gd2.phpt trunk/ext/gd/libgd/gd_gd.c trunk/ext/gd/tests/crafted.gd2 trunk/ext/gd/tests/crafted_gd2.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-60660@lists.php.net to get a copy of this message | ||
pajoye Mon, 12 Oct 2009 10:01:37 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=289557
Log:
- check max colors while loading gd2 palette image (patch by Tomas Hoger)
Changed paths:
U php/php-src/branches/PHP_5_2/ext/gd/libgd/gd_gd.c
A php/php-src/branches/PHP_5_2/ext/gd/tests/crafted.gd2
A php/php-src/branches/PHP_5_2/ext/gd/tests/crafted_gd2.phpt
U php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_gd.c
A php/php-src/branches/PHP_5_3/ext/gd/tests/crafted.gd2
A php/php-src/branches/PHP_5_3/ext/gd/tests/crafted_gd2.phpt
U php/php-src/branches/PHP_5_3_1/ext/gd/libgd/gd_gd.c
A php/php-src/branches/PHP_5_3_1/ext/gd/tests/crafted.gd2
A php/php-src/branches/PHP_5_3_1/ext/gd/tests/crafted_gd2.phpt
U php/php-src/trunk/ext/gd/libgd/gd_gd.c
A php/php-src/trunk/ext/gd/tests/crafted.gd2
A php/php-src/trunk/ext/gd/tests/crafted_gd2.phpt
Modified: php/php-src/branches/PHP_5_2/ext/gd/libgd/gd_gd.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/gd/libgd/gd_gd.c 2009-10-12 09:44:18 UTC (rev 289556)
+++ php/php-src/branches/PHP_5_2/ext/gd/libgd/gd_gd.c 2009-10-12 10:01:37 UTC (rev 289557)
@@ -39,6 +39,9 @@
if (!gdGetWord(&im->colorsTotal, in)) {
goto fail1;
}
+ if (im->colorsTotal > gdMaxColors) {
+ goto fail1;
+ }
}
/* Int to accommodate truecolor single-color transparency */
if (!gdGetInt(&im->transparent, in)) {
Added: php/php-src/branches/PHP_5_2/ext/gd/tests/crafted.gd2
===================================================================
(Binary files differ)
Property changes on: php/php-src/branches/PHP_5_2/ext/gd/tests/crafted.gd2
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: php/php-src/branches/PHP_5_2/ext/gd/tests/crafted_gd2.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/gd/tests/crafted_gd2.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/gd/tests/crafted_gd2.phpt 2009-10-12 10:01:37 UTC (rev 289557)
@@ -0,0 +1,16 @@
+--TEST--
+Test max colors for a gd image.
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) {
+ die("skip gd extension not available\n");
+ }
+?>
+--FILE--
+<?php
+imagecreatefromgd(dirname(__FILE__) . '/crafted.gd2');
+?>
+--EXPECTF--
+
+Warning: imagecreatefromgd(): '%scrafted.gd2' is not a valid GD file in %s on line %d
+
Modified: php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_gd.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_gd.c 2009-10-12 09:44:18 UTC (rev 289556)
+++ php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_gd.c 2009-10-12 10:01:37 UTC (rev 289557)
@@ -39,6 +39,9 @@
if (!gdGetWord(&im->colorsTotal, in)) {
goto fail1;
}
+ if (im->colorsTotal > gdMaxColors) {
+ goto fail1;
+ }
}
/* Int to accommodate truecolor single-color transparency */
if (!gdGetInt(&im->transparent, in)) {
Added: php/php-src/branches/PHP_5_3/ext/gd/tests/crafted.gd2
===================================================================
(Binary files differ)
Property changes on: php/php-src/branches/PHP_5_3/ext/gd/tests/crafted.gd2
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: php/php-src/branches/PHP_5_3/ext/gd/tests/crafted_gd2.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/gd/tests/crafted_gd2.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/gd/tests/crafted_gd2.phpt 2009-10-12 10:01:37 UTC (rev 289557)
@@ -0,0 +1,16 @@
+--TEST--
+Test max colors for a gd image.
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) {
+ die("skip gd extension not available\n");
+ }
+?>
+--FILE--
+<?php
+imagecreatefromgd(dirname(__FILE__) . '/crafted.gd2');
+?>
+--EXPECTF--
+
+Warning: imagecreatefromgd(): '%scrafted.gd2' is not a valid GD file in %s on line %d
+
Modified: php/php-src/branches/PHP_5_3_1/ext/gd/libgd/gd_gd.c
===================================================================
--- php/php-src/branches/PHP_5_3_1/ext/gd/libgd/gd_gd.c 2009-10-12 09:44:18 UTC (rev 289556)
+++ php/php-src/branches/PHP_5_3_1/ext/gd/libgd/gd_gd.c 2009-10-12 10:01:37 UTC (rev 289557)
@@ -39,6 +39,9 @@
if (!gdGetWord(&im->colorsTotal, in)) {
goto fail1;
}
+ if (im->colorsTotal > gdMaxColors) {
+ goto fail1;
+ }
}
/* Int to accommodate truecolor single-color transparency */
if (!gdGetInt(&im->transparent, in)) {
Added: php/php-src/branches/PHP_5_3_1/ext/gd/tests/crafted.gd2
===================================================================
(Binary files differ)
Property changes on: php/php-src/branches/PHP_5_3_1/ext/gd/tests/crafted.gd2
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: php/php-src/branches/PHP_5_3_1/ext/gd/tests/crafted_gd2.phpt
===================================================================
--- php/php-src/branches/PHP_5_3_1/ext/gd/tests/crafted_gd2.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3_1/ext/gd/tests/crafted_gd2.phpt 2009-10-12 10:01:37 UTC (rev
289557)
@@ -0,0 +1,16 @@
+--TEST--
+Test max colors for a gd image.
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) {
+ die("skip gd extension not available\n");
+ }
+?>
+--FILE--
+<?php
+imagecreatefromgd(dirname(__FILE__) . '/crafted.gd2');
+?>
+--EXPECTF--
+
+Warning: imagecreatefromgd(): '%scrafted.gd2' is not a valid GD file in %s on line %d
+
Modified: php/php-src/trunk/ext/gd/libgd/gd_gd.c
===================================================================
--- php/php-src/trunk/ext/gd/libgd/gd_gd.c 2009-10-12 09:44:18 UTC (rev 289556)
+++ php/php-src/trunk/ext/gd/libgd/gd_gd.c 2009-10-12 10:01:37 UTC (rev 289557)
@@ -39,6 +39,9 @@
if (!gdGetWord(&im->colorsTotal, in)) {
goto fail1;
}
+ if (im->colorsTotal > gdMaxColors) {
+ goto fail1;
+ }
}
/* Int to accommodate truecolor single-color transparency */
if (!gdGetInt(&im->transparent, in)) {
Added: php/php-src/trunk/ext/gd/tests/crafted.gd2
===================================================================
(Binary files differ)
Property changes on: php/php-src/trunk/ext/gd/tests/crafted.gd2
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: php/php-src/trunk/ext/gd/tests/crafted_gd2.phpt
===================================================================
--- php/php-src/trunk/ext/gd/tests/crafted_gd2.phpt (rev 0)
+++ php/php-src/trunk/ext/gd/tests/crafted_gd2.phpt 2009-10-12 10:01:37 UTC (rev 289557)
@@ -0,0 +1,16 @@
+--TEST--
+Test max colors for a gd image.
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) {
+ die("skip gd extension not available\n");
+ }
+?>
+--FILE--
+<?php
+imagecreatefromgd(dirname(__FILE__) . '/crafted.gd2');
+?>
+--EXPECTF--
+
+Warning: imagecreatefromgd(): '%scrafted.gd2' is not a valid GD file in %s on line %d
+