mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
fix the fix for bug #70976 (imagerotate)
This commit is contained in:
parent
a6734f70e1
commit
aa8d3a8cc6
@ -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);
|
||||
|
@ -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)
|
Loading…
Reference in New Issue
Block a user