fix the fix for bug #70976 (imagerotate)

This commit is contained in:
Remi Collet 2016-01-12 13:52:27 +01:00 committed by Julien Pauli
parent a6734f70e1
commit aa8d3a8cc6
2 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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)
resource(5) of type (gd)