diff --git a/NEWS b/NEWS index 922452e4bf6..a1e5a2cb247 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ PHP NEWS - GD: . Fixed bug GH-17349 (Tiled truecolor filling looses single color transparency). (cmb) + . Fixed bug GH-17373 (imagefttext() ignores clipping rect for palette + images). (cmb) - Intl: . Fixed bug GH-11874 (intl causing segfault in docker images). (nielsdos) diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index 6876ca6f6b4..953da001bbe 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -720,7 +720,7 @@ static char * gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg, y = pen_y + row; /* clip if out of bounds */ - if (y >= im->sy || y < 0) { + if (y > im->cy2 || y < im->cy1) { continue; } @@ -743,7 +743,7 @@ static char * gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg, x = pen_x + col; /* clip if out of bounds */ - if (x >= im->sx || x < 0) { + if (x > im->cx2 || x < im->cx1) { continue; } /* get pixel location in gd buffer */ diff --git a/ext/gd/tests/gh17373.phpt b/ext/gd/tests/gh17373.phpt new file mode 100644 index 00000000000..354cdd07362 --- /dev/null +++ b/ext/gd/tests/gh17373.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug GH-17373 (imagefttext() ignores clipping rect for palette images) +--EXTENSIONS-- +gd +--FILE-- + +--EXPECT-- +int(0)