Patch zero-rectangle for GD related Bug #53154
Patch version 2015-06-29 11:34 UTC
Return to Bug #53154 |
Download this patch
Patch Revisions:
Developer: cmb@php.net
ext/gd/libgd/gd.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index 3164a2c..3460292 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -2093,12 +2093,16 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
return;
} else {
- y1v = y1h + 1;
- y2v = y2h - 1;
- gdImageLine(im, x1h, y1h, x2h, y1h, color);
- gdImageLine(im, x1h, y2h, x2h, y2h, color);
- gdImageLine(im, x1v, y1v, x1v, y2v, color);
- gdImageLine(im, x2v, y1v, x2v, y2v, color);
+ if (x1 == x2 || y1 == y2) {
+ gdImageLine(im, x1, y1, x2, y2, color);
+ } else {
+ y1v = y1h + 1;
+ y2v = y2h - 1;
+ gdImageLine(im, x1h, y1h, x2h, y1h, color);
+ gdImageLine(im, x1h, y2h, x2h, y2h, color);
+ gdImageLine(im, x1v, y1v, x1v, y2v, color);
+ gdImageLine(im, x2v, y1v, x2v, y2v, color);
+ }
}
}
|