summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-07-06 10:40:52 +0200
committerAnatol Belski <ab@php.net>2016-07-06 10:40:52 +0200
commitb63d41e1e5cec186c06368a1fd9fd5d56be1994d (patch)
treecca63c6135cedee29a9af4268fd5fe032d9dbb3c
parent7b2c22696ad44df1d26d70e15521adebd95c0399 (diff)
downloadphp-git-b63d41e1e5cec186c06368a1fd9fd5d56be1994d.tar.gz
add tests for bug #72512
-rw-r--r--ext/gd/tests/bug72512_0.phpt18
-rw-r--r--ext/gd/tests/bug72512_1.phpt18
2 files changed, 36 insertions, 0 deletions
diff --git a/ext/gd/tests/bug72512_0.phpt b/ext/gd/tests/bug72512_0.phpt
new file mode 100644
index 0000000000..5f98662d45
--- /dev/null
+++ b/ext/gd/tests/bug72512_0.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access, var 0
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+?>
+--FILE--
+<?php
+
+$img = imagecreatetruecolor(13, 1007);
+
+imagecolortransparent($img, -10066304);
+imagetruecolortopalette($img, TRUE, 3);
+imagescale($img, 1, 65535);
+?>
+==DONE==
+--EXPECT--
+==DONE==
diff --git a/ext/gd/tests/bug72512_1.phpt b/ext/gd/tests/bug72512_1.phpt
new file mode 100644
index 0000000000..bba01a7118
--- /dev/null
+++ b/ext/gd/tests/bug72512_1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access, var 1
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+?>
+--FILE--
+<?php
+
+$img = imagecreatetruecolor(100, 100);
+imagecolortransparent($img, -1000000);
+imagetruecolortopalette($img, TRUE, 3);
+imagecolortransparent($img, 9);
+
+?>
+==DONE==
+--EXPECT--
+==DONE==