summaryrefslogtreecommitdiff
path: root/ext/zip
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-10-27 14:17:57 +0200
committerAnatol Belski <ab@php.net>2017-10-27 14:17:57 +0200
commit211dacd7b5c945580e763f7322be85b8be7d92ec (patch)
treefc5c97c06d390ec2de42e31bc041f4a185b8f8aa /ext/zip
parentfb1c573a295994c3afe197215bf9eba2979cf0e7 (diff)
parent10dc1950f734e41ae001f295b12b54114e247c5e (diff)
downloadphp-git-211dacd7b5c945580e763f7322be85b8be7d92ec.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Apply upstream patch for CVE-2017-14107 Backport and apply upstream patch for CVE-2017-14107
Diffstat (limited to 'ext/zip')
-rw-r--r--ext/zip/lib/zip_open.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c
index d6209ee1e7..29409b747d 100644
--- a/ext/zip/lib/zip_open.c
+++ b/ext/zip/lib/zip_open.c
@@ -837,7 +837,12 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
zip_error_set(error, ZIP_ER_SEEK, EFBIG);
return NULL;
}
- if ((flags & ZIP_CHECKCONS) && offset+size != eocd_offset) {
+ if (offset+size > buf_offset + eocd_offset) {
+ /* cdir spans past EOCD record */
+ zip_error_set(error, ZIP_ER_INCONS, 0);
+ return NULL;
+ }
+ if ((flags & ZIP_CHECKCONS) && offset+size != buf_offset + eocd_offset) {
zip_error_set(error, ZIP_ER_INCONS, 0);
return NULL;
}