summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemi Collet <remi@php.net>2016-01-12 13:52:27 +0100
committerJulien Pauli <jpauli@php.net>2016-01-12 14:03:35 +0100
commitaa8d3a8cc612ba87c0497275f58a2317a90fb1c4 (patch)
tree8bcefcee65fdef750c490761393c6311bec03fdb
parenta6734f70e124fcccb1b488f40cc00a1fa07b5d4a (diff)
downloadphp-git-aa8d3a8cc612ba87c0497275f58a2317a90fb1c4.tar.gz
fix the fix for bug #70976 (imagerotate)
-rw-r--r--ext/gd/libgd/gd_interpolation.c4
-rw-r--r--ext/gd/tests/bug70976.phpt4
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index eb35efb470..6b7360a6de 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -2154,7 +2154,7 @@ gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, in
{
const int angle_rounded = (int)floor(angle * 100);
- if (bgcolor < 0 || (!src->trueColor && bgcolor >= gdMaxColors)) {
+ if (bgcolor < 0) {
return NULL;
}
@@ -2162,7 +2162,7 @@ gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, in
images can be done at a later point.
*/
if (src->trueColor == 0) {
- if (bgcolor >= 0) {
+ if (bgcolor < gdMaxColors) {
bgcolor = gdTrueColorAlpha(src->red[bgcolor], src->green[bgcolor], src->blue[bgcolor], src->alpha[bgcolor]);
}
gdImagePaletteToTrueColor(src);
diff --git a/ext/gd/tests/bug70976.phpt b/ext/gd/tests/bug70976.phpt
index 23af4eedc7..dfbd4b49ec 100644
--- a/ext/gd/tests/bug70976.phpt
+++ b/ext/gd/tests/bug70976.phpt
@@ -6,8 +6,8 @@ Bug #70976 (Memory Read via gdImageRotateInterpolated Array Index Out of Bounds)
?>
--FILE--
<?php
-$img = imagerotate(imagecreate(1,1),45,0x7ffffff9);
+$img = imagerotate(imagecreate(10,10),45,0x7ffffff9);
var_dump($img);
?>
--EXPECTF--
-bool(false) \ No newline at end of file
+resource(5) of type (gd) \ No newline at end of file