Check ph.c_len; CERT-FI 829767

id:000010,sig:06,src:000000,op:flip1,pos:11584
This commit is contained in:
John Reiser 2015-05-09 07:13:47 -07:00
parent 8d6c594240
commit 52f9ef14b9

View File

@ -1294,7 +1294,7 @@ void PackMachBase<T>::unpack(OutputFile *fo)
fi->readx(&bhdr, sizeof(bhdr));
ph.u_len = get_te32(&bhdr.sz_unc);
ph.c_len = get_te32(&bhdr.sz_cpr);
if (file_size < ph.c_len)
if (file_size < ph.c_len || ph.c_len == 0 || ph.u_len == 0)
throwCantUnpack("file header corrupted");
ph.method = bhdr.b_method;
ph.filter = bhdr.b_ftid;