com php-src: Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary: NEWS ext/zip/lib/zip_dirent.c
| From: | Stanislav Malyshev | Date: | Wed, 18 Mar 2015 04:59:56 +0000 |
| Subject: | com php-src: Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary: NEWS ext/zip/lib/zip_dirent.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85602@lists.php.net to get a copy of this message | ||
Commit: ef8fc4b53d92fbfcd8ef1abbd6f2f5fe2c4a11e5
Author: Stanislav Malyshev <stas@php.net> Tue, 17 Mar 2015 21:59:56 -0700
Parents: fb04dcf6dbb48aecd8d2dc986806cb58c8ae5282
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ef8fc4b53d92fbfcd8ef1abbd6f2f5fe2c4a11e5
Log:
Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary
Bugs:
https://bugs.php.net/69253
Changed paths:
M NEWS
M ext/zip/lib/zip_dirent.c
Diff:
diff --git a/NEWS b/NEWS
index 06857cc..0ce25d0 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,10 @@ PHP NEWS
. Fixed bug #69085 (SoapClient's __call() type confusion through
unserialize()). (Dmitry)
+- ZIP:
+ . Fixed bug #69253 (ZIP Integer Overflow leads to writing past heap
+ boundary). (Stas)
+
19 Feb 2015 PHP 5.4.38
- Core:
diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c
index b9dac5c..0090801 100644
--- a/ext/zip/lib/zip_dirent.c
+++ b/ext/zip/lib/zip_dirent.c
@@ -101,7 +101,7 @@ _zip_cdir_new(int nentry, struct zip_error *error)
return NULL;
}
- if ((cd->entry=(struct zip_dirent *)malloc(sizeof(*(cd->entry))*nentry))
+ if ( nentry > ((size_t)-1)/sizeof(*(cd->entry)) || (cd->entry=(struct zip_dirent
*)malloc(sizeof(*(cd->entry))*(size_t)nentry))
== NULL) {
_zip_error_set(error, ZIP_ER_MEMORY, 0);
free(cd);