another check on b_info in ::unpackExtent()

This commit is contained in:
John Reiser 2015-05-16 15:18:28 -07:00
parent 7d4dfbef2b
commit 2238c99b61

View File

@ -449,13 +449,13 @@ void PackUnix::unpackExtent(unsigned wanted, OutputFile *fo,
ph.filter_cto = hdr.b_cto8;
if (sz_unc == 0) { // must never happen while 0!=wanted
throwCompressedDataViolation();
throwCantUnpack("corrupt b_info");
break;
}
if (sz_unc <= 0 || sz_cpr <= 0)
throwCompressedDataViolation();
throwCantUnpack("corrupt b_info");
if (sz_cpr > sz_unc || sz_unc > (int)blocksize)
throwCompressedDataViolation();
throwCantUnpack("corrupt b_info");
int j = blocksize + OVERHEAD - sz_cpr;
fi->readx(ibuf+j, sz_cpr);
@ -493,6 +493,8 @@ void PackUnix::unpackExtent(unsigned wanted, OutputFile *fo,
// write block
if (fo)
fo->write(ibuf + j, sz_unc);
if (wanted < (unsigned)sz_unc)
throwCantUnpack("corrupt b_info");
wanted -= sz_unc;
}
}