diff options
author | Stanislav Malyshev <stas@php.net> | 2016-07-19 22:38:35 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2016-07-19 22:38:35 -0700 |
commit | df5ee7bc2557fd87a7e296d399cd947d68c1a4d3 (patch) | |
tree | e2163cddfde6d941e5184c637b4acc10027f0265 | |
parent | ec97e78a8d13eb03df962f0e8604a603604b2042 (diff) | |
parent | 17a53f9e60d0cd01fe271e245efa7306537acbcf (diff) | |
download | php-git-df5ee7bc2557fd87a7e296d399cd947d68c1a4d3.tar.gz |
Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
Improve fix for #72520
#72482, revert for 5.6 for now
Conflicts:
ext/zip/zip_stream.c
-rw-r--r-- | ext/gd/libgd/gd.c | 49 | ||||
-rw-r--r-- | ext/zip/zip_stream.c | 4 |
2 files changed, 49 insertions, 4 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 1f4d6c40ac..51258d484f 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -1299,10 +1299,55 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) long x, y, inc; long dx, dy,tmp; - /* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */ - if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) { + if (y1 < 0 && y2 < 0) { + return; + } + if (y1 < 0) { + x1 += (y1 * (x1 - x2)) / (y2 - y1); + y1 = 0; + } + if (y2 < 0) { + x2 += (y2 * (x1 - x2)) / (y2 - y1); + y2 = 0; + } + + /* bottom edge */ + if (y1 >= im->sy && y2 >= im->sy) { + return; + } + if (y1 >= im->sy) { + x1 -= ((im->sy - y1) * (x1 - x2)) / (y2 - y1); + y1 = im->sy - 1; + } + if (y2 >= im->sy) { + x2 -= ((im->sy - y2) * (x1 - x2)) / (y2 - y1); + y2 = im->sy - 1; + } + + /* left edge */ + if (x1 < 0 && x2 < 0) { return; } + if (x1 < 0) { + y1 += (x1 * (y1 - y2)) / (x2 - x1); + x1 = 0; + } + if (x2 < 0) { + y2 += (x2 * (y1 - y2)) / (x2 - x1); + x2 = 0; + } + /* right edge */ + if (x1 >= im->sx && x2 >= im->sx) { + return; + } + if (x1 >= im->sx) { + y1 -= ((im->sx - x1) * (y1 - y2)) / (x2 - x1); + x1 = im->sx - 1; + } + if (x2 >= im->sx) { + y2 -= ((im->sx - x2) * (y1 - y2)) / (x2 - x1); + x2 = im->sx - 1; + } dx = x2 - x1; dy = y2 - y1; diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index d586233dee..244ff4dfa5 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -124,11 +124,11 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ { struct zip_stat sb; const char *path = stream->orig_path; - int path_len = strlen(stream->orig_path); + size_t path_len = strlen(stream->orig_path); char file_dirname[MAXPATHLEN]; struct zip *za; char *fragment; - int fragment_len; + size_t fragment_len; int err; zend_string *file_basename; |