com php-src: Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary: ext/zip/lib/zip_dirent.c
| From: | Ferenc Kovacs | Date: | Wed, 18 Mar 2015 23:51:10 +0000 |
| Subject: | com php-src: Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary: ext/zip/lib/zip_dirent.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85635@lists.php.net to get a copy of this message | ||
Commit: ec779124cb7279493ce1ca1088d1aaa32e82479a
Author: Stanislav Malyshev <stas@php.net> Tue, 17 Mar 2015 21:59:56 -0700
Committer: Ferenc Kovacs <tyrael@php.net> Thu, 19 Mar 2015 00:51:10 +0100
Parents: 5fd617f2f5afa3a687969e7844864e027f97d964
Branches: PHP-5.6.7
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ec779124cb7279493ce1ca1088d1aaa32e82479a
Log:
Fix bug #69253 - ZIP Integer Overflow leads to writing past heap boundary
Bugs:
https://bugs.php.net/69253
Changed paths:
M ext/zip/lib/zip_dirent.c
Diff:
diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c
index 38e7ece..5b8da73 100644
--- a/ext/zip/lib/zip_dirent.c
+++ b/ext/zip/lib/zip_dirent.c
@@ -110,7 +110,7 @@ _zip_cdir_new(zip_uint64_t nentry, struct zip_error *error)
if (nentry == 0)
cd->entry = NULL;
- else if ((cd->entry=(struct zip_entry *)malloc(sizeof(*(cd->entry))*(size_t)nentry)) ==
NULL) {
+ else if (nentry > ((size_t)-1)/sizeof(*(cd->entry)) || (cd->entry=(struct zip_entry
*)malloc(sizeof(*(cd->entry))*(size_t)nentry)) == NULL) {
_zip_error_set(error, ZIP_ER_MEMORY, 0);
free(cd);
return NULL;