From: Josef Möllers Date: Mon, 26 Mar 2018 10:27:34 +0000 (+0200) Subject: zzip_mem_entry_new(): if compressed size is too big, bail out. X-Git-Tag: v0.13.70~21^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4393a756cea723e6d4b2fa70310f64a2e1303f94;p=zziplib zzip_mem_entry_new(): if compressed size is too big, bail out. --- diff --git a/zzip/memdisk.c b/zzip/memdisk.c index 8d5743d..7c59602 100644 --- a/zzip/memdisk.c +++ b/zzip/memdisk.c @@ -222,6 +222,14 @@ zzip_mem_entry_new(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) item->zz_filetype = zzip_disk_entry_get_filetype(entry); /* + * If zz_data+zz_csize exceeds the size of the file, bail out + */ + if ((item->zz_data + item->zz_csize) < disk->buffer || + (item->zz_data + item->zz_csize) >= disk->endbuf) + { + goto error; + } + /* * If the file is uncompressed, zz_csize and zz_usize should be the same * If they are not, we cannot guarantee that either is correct, so ... */