Check ph.c_len; CERT-FI 829767

id:000008,sig:06,src:000000,op:flip1,pos:205
This commit is contained in:
John Reiser
2015-05-09 07:05:17 -07:00
parent 7ad77ff540
commit 8d6c594240
+5
View File
@@ -3022,6 +3022,9 @@ void PackLinuxElf64::unpack(OutputFile *fo)
fi->readx(&bhdr, szb_info);
ph.u_len = get_te32(&bhdr.sz_unc);
ph.c_len = get_te32(&bhdr.sz_cpr);
if (ph.c_len > fi->st_size())
throwCantUnpack("file header corrupted");
ph.filter_cto = bhdr.b_cto8;
// Uncompress Ehdr and Phdrs.
@@ -3538,6 +3541,8 @@ void PackLinuxElf32::unpack(OutputFile *fo)
fi->readx(&bhdr, szb_info);
ph.u_len = get_te32(&bhdr.sz_unc);
ph.c_len = get_te32(&bhdr.sz_cpr);
if (ph.c_len > fi->st_size())
throwCantUnpack("file header corrupted");
ph.filter_cto = bhdr.b_cto8;
bool const is_shlib = (ehdr->e_entry==0) || (ehdr->e_shoff!=0);