fix #215 gdImageFillToBorder stack-overflow when invalid color is used
parent
73f4e0339a
commit
77f619d482
8
src/gd.c
8
src/gd.c
|
@ -1928,11 +1928,17 @@ BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border,
|
|||
int i;
|
||||
int restoreAlphaBleding;
|
||||
|
||||
if (border < 0) {
|
||||
if (border < 0 || color < 0) {
|
||||
/* Refuse to fill to a non-solid border */
|
||||
return;
|
||||
}
|
||||
|
||||
if (!im->trueColor) {
|
||||
if ((color > (im->colorsTotal - 1)) || (border > (im->colorsTotal - 1))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
leftLimit = (-1);
|
||||
|
||||
restoreAlphaBleding = im->alphaBlendingFlag;
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
/bug00037
|
||||
/github_bug_215
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
SET(TESTS_FILES
|
||||
bug00037
|
||||
github_bug_215
|
||||
)
|
||||
|
||||
ADD_GD_TESTS()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
if HAVE_LIBPNG
|
||||
libgd_test_programs += \
|
||||
gdimagefilltoborder/bug00037
|
||||
gdimagefilltoborder/bug00037 \
|
||||
gdimagefilltoborder/github_bug_215
|
||||
endif
|
||||
|
||||
EXTRA_DIST += \
|
||||
|
|
Loading…
Reference in New Issue