From cee0a7df2445ba9217f1c06269a38bf09aef4865 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Thu, 28 Sep 2006 08:48:02 +0000 Subject: [PATCH] - imagefill(), infinite loop with wrong color index --- ext/gd/libgd/gd.c | 4 ++++ ext/gd/tests/imagefill_1.phpt | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 ext/gd/tests/imagefill_1.phpt diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index bb12cefc0c..3edec2edf4 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -1885,6 +1885,10 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc) struct seg *stack; struct seg *sp; + if (!im->trueColor && nc > (im->colorsTotal -1)) { + return; + } + alphablending_bak = im->alphaBlendingFlag; im->alphaBlendingFlag = 0; diff --git a/ext/gd/tests/imagefill_1.phpt b/ext/gd/tests/imagefill_1.phpt new file mode 100644 index 0000000000..04e1cab55a --- /dev/null +++ b/ext/gd/tests/imagefill_1.phpt @@ -0,0 +1,25 @@ +--TEST-- +imagefill() infinite loop with wrong color index +--SKIPIF-- + +--FILE-- + +--EXPECT-- +00 -- 2.50.1