From d76514d8920eba1c3131370df75debcaac05767b Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Sat, 13 Mar 2004 23:36:29 +0000 Subject: [PATCH] - MFH bug #27582 (imagefilltoborder crashes) --- ext/gd/libgd/gd.c | 11 +++++++++++ ext/gd/tests/bug27582_1.phpt | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 ext/gd/tests/bug27582_1.phpt diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index e7edf12880..a800aa8397 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -1769,6 +1769,11 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) return; } + if (im->alphaBlendingFlag) { + restoreAlphaBleding = 1; + im->alphaBlendingFlag = 0; + } + if (x >= im->sx) { x = im->sx - 1; } @@ -1784,6 +1789,9 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) leftLimit = i; } if (leftLimit == -1) { + if (restoreAlphaBleding) { + im->alphaBlendingFlag = 1; + } return; } /* Seek right */ @@ -1827,6 +1835,9 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) } } } + if (restoreAlphaBleding) { + im->alphaBlendingFlag = 1; + } } diff --git a/ext/gd/tests/bug27582_1.phpt b/ext/gd/tests/bug27582_1.phpt new file mode 100644 index 0000000000..6dee785b16 --- /dev/null +++ b/ext/gd/tests/bug27582_1.phpt @@ -0,0 +1,23 @@ +--TEST-- +gdimagefill() function (Bug #19366 (fixed in bundled libgd)) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +08287f8f5d406946009df5f04ca83dc0 -- 2.40.0