diff options
author | Christoph M. Becker <cmb@php.net> | 2015-07-19 21:51:35 +0200 |
---|---|---|
committer | Christoph M. Becker <cmb@php.net> | 2015-07-19 21:54:55 +0200 |
commit | d3958b32caf606a2710436f8c80df58152e3b160 (patch) | |
tree | 8983949594de68247363d63009063b37c64984fb | |
parent | 9e08c990ac42d254e2a89eff5782505e823a12e4 (diff) | |
download | php-git-d3958b32caf606a2710436f8c80df58152e3b160.tar.gz |
fixed Fix #66590, which may segfault
-rw-r--r-- | ext/gd/libgd/webpimg.c | 1 | ||||
-rw-r--r-- | ext/gd/tests/bug66590_1.phpt | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/ext/gd/libgd/webpimg.c b/ext/gd/libgd/webpimg.c index 1b160232f2..6ce991fbdd 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 0000000000..9e598d1eae --- /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 |