summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemi Collet <remi@php.net>2016-01-12 13:52:27 +0100
committerRemi Collet <remi@php.net>2016-01-12 13:52:27 +0100
commit14e4d393cf07a43fc68853e6d9cd9440a950d002 (patch)
tree4f0a5722afc43e42b1a57abb8ef0a1c50c9ff741
parent63c77ee4b12f8489f50add87af4371d9511b0295 (diff)
downloadphp-git-14e4d393cf07a43fc68853e6d9cd9440a950d002.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 2f5df48927..24fc3ce529 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -2162,7 +2162,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;
}
@@ -2170,7 +2170,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