mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Detect (int)blocksize < 0
This commit is contained in:
parent
83ce7dc62f
commit
cdd152d015
|
@ -3014,7 +3014,8 @@ void PackLinuxElf64::unpack(OutputFile *fo)
|
||||||
p_info hbuf; fi->readx(&hbuf, sizeof(hbuf));
|
p_info hbuf; fi->readx(&hbuf, sizeof(hbuf));
|
||||||
unsigned orig_file_size = get_te32(&hbuf.p_filesize);
|
unsigned orig_file_size = get_te32(&hbuf.p_filesize);
|
||||||
blocksize = get_te32(&hbuf.p_blocksize);
|
blocksize = get_te32(&hbuf.p_blocksize);
|
||||||
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size)
|
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size
|
||||||
|
|| (int)(blocksize + OVERHEAD) < 0)
|
||||||
throwCantUnpack("p_info corrupted");
|
throwCantUnpack("p_info corrupted");
|
||||||
|
|
||||||
ibuf.alloc(blocksize + OVERHEAD);
|
ibuf.alloc(blocksize + OVERHEAD);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user