Unpacking detects and defends against malicious ELF

This commit is contained in:
John Reiser
2024-03-28 07:48:55 -07:00
committed by Markus F.X.J. Oberhumer
parent d1f62e3ab4
commit 3949af6d3c
2 changed files with 18 additions and 8 deletions
+4 -2
View File
@@ -491,8 +491,10 @@ unsigned PackUnix::unpackExtent(unsigned wanted, OutputFile *fo,
throwCantUnpack("corrupt b_info");
// place the input for overlapping de-compression
// FIXME: inlen cheats OVERHEAD; assumes small wanted peek length
int j = inlen + blocksize + OVERHEAD - sz_cpr;
int j = inlen + sz_unc + OVERHEAD - sz_cpr;
if (ibuf.getSize() < (unsigned)(j + sz_cpr)) {
throwCantUnpack("corrupt b_info");
}
fi->readx(ibuf+j, sz_cpr);
total_in += sz_cpr;
// update checksum of compressed data