com php-src: Fix #73280: Stack Buffer Overflow in GD dynamicGetbuf: ext/gd/libgd/gd_io_dp.c
| From: | Anatol Belski | Date: | Fri, 14 Oct 2016 00:02:42 +0000 |
| Subject: | com php-src: Fix #73280: Stack Buffer Overflow in GD dynamicGetbuf: ext/gd/libgd/gd_io_dp.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95038@lists.php.net to get a copy of this message | ||
Commit: 086491555022b3b0ec59d26c6442a302171666ba
Author: Christoph M. Becker <cmbecker69@gmx.de> Thu, 13 Oct 2016 11:10:02 +0200
Committer: Anatol Belski <ab@php.net> Fri, 14 Oct 2016 02:02:42 +0200
Parents: 20b63996c07f4a53ace391db9d6d1b3b57af2030
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=086491555022b3b0ec59d26c6442a302171666ba
Log:
Fix #73280: Stack Buffer Overflow in GD dynamicGetbuf
We make sure to never pass a negative
rlen as size to memcpy().
Cf. <https://github.com/libgd/libgd/commit/53110871>.
(cherry picked from commit cc08cbc84d46933c1e9e0149633f1ed5d19e45e9)
Bugs:
https://bugs.php.net/73280
Changed paths:
M ext/gd/libgd/gd_io_dp.c
Diff:
diff --git a/ext/gd/libgd/gd_io_dp.c b/ext/gd/libgd/gd_io_dp.c
index bfeb4cb..4dcedde 100644
--- a/ext/gd/libgd/gd_io_dp.c
+++ b/ext/gd/libgd/gd_io_dp.c
@@ -237,7 +237,7 @@ static int dynamicGetbuf (gdIOCtxPtr ctx, void *buf, int len)
if (remain >= len) {
rlen = len;
} else {
- if (remain == 0) {
+ if (remain <= 0) {
return EOF;
}
rlen = remain;