diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index 67f553ebc9d..dc5cdde0aa6 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)