com php-src: fixed Fix #66590, which may segfault: ext/gd/libgd/webpimg.c ext/gd/tests/bug66590_1.phpt
| From: | Christoph Michael Becker | Date: | Sun, 19 Jul 2015 19:54:55 +0000 |
| Subject: | com php-src: fixed Fix #66590, which may segfault: ext/gd/libgd/webpimg.c ext/gd/tests/bug66590_1.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88044@lists.php.net to get a copy of this message | ||
Commit: d3958b32caf606a2710436f8c80df58152e3b160
Author: Christoph M. Becker <cmb@php.net> Sun, 19 Jul 2015 21:51:35 +0200
Parents: 9e08c990ac42d254e2a89eff5782505e823a12e4
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d3958b32caf606a2710436f8c80df58152e3b160
Log:
fixed Fix #66590, which may segfault
Bugs:
https://bugs.php.net/66590
Changed paths:
M ext/gd/libgd/webpimg.c
A ext/gd/tests/bug66590_1.phpt
Diff:
diff --git a/ext/gd/libgd/webpimg.c b/ext/gd/libgd/webpimg.c
index 1b160232..6ce991f 100644
--- a/ext/gd/libgd/webpimg.c
+++ b/ext/gd/libgd/webpimg.c
@@ -789,6 +789,7 @@ WebPResult WebPEncode(const uint8* Y,
return webp_failure;
}
p[new_size - 1] = 0;
+ *p_out = p;
*p_out_size_bytes = new_size;
}
diff --git a/ext/gd/tests/bug66590_1.phpt b/ext/gd/tests/bug66590_1.phpt
new file mode 100644
index 0000000..9e598d1
--- /dev/null
+++ b/ext/gd/tests/bug66590_1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #66590 (imagewebp() doesn't pad to even length) - segfault
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!function_exists('imagewebp')) die('skip WebP support not available');
+?>
+--FILE--
+<?php
+$im = imagecreatetruecolor(6, 6);
+ob_start();
+imagewebp($im);
+ob_end_clean();
+echo "ready\n";
+?>
+--EXPECT--
+ready