summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2004-03-02 21:56:30 +0000
committerDerick Rethans <derick@php.net>2004-03-02 21:56:30 +0000
commit596efe5197b106ecd6ab3bb84a8ef57ce7c4ddf1 (patch)
treefe5674ffbaf182b8eb60ca45e0d8effbb61cac00
parent21141e1378587fb5567b0c5d6f9794ee21880c8d (diff)
downloadphp-git-596efe5197b106ecd6ab3bb84a8ef57ce7c4ddf1.tar.gz
- Fixed bug in gdImageFilledRectangle in the bundled GD library, that required
x1 < x2 and y1 < y2 for coordinates.
-rw-r--r--NEWS2
-rw-r--r--ext/gd/libgd/gd.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 147bcd9a0f..d6b16a7e73 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ PHP NEWS
- Methods that override parent methods are now subject to prototype checking,
and have to be compatible with the method they're overriding - this check is
disabled in compatibility mode. (Andi, Zeev)
+- Fixed bug in gdImageFilledRectangle in the bundled GD library, that required
+ x1 < x2 and y1 < y2 for coordinates. (Derick)
- Fixed crash with foreach() and temporary objects($obj->method()->a ...) where
method returns a non-referenced object. (Andi, Zeev)
- Fixed problem preventing startup errors from being displayed. (Marcus)
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index 5b798fad4c..1459f4cb5f 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -2038,6 +2038,16 @@ void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int
if (y1 > gdImageSY(im)) {
y1 = gdImageSY(im);
}
+ if (x1 > x2) {
+ x = x1;
+ x1 = x2;
+ x2 = x;
+ }
+ if (y1 > y2) {
+ y = y1;
+ y1 = y2;
+ y2 = y;
+ }
for (y = y1; (y <= y2); y++) {
for (x = x1; (x <= x2); x++) {