mirror of https://github.com/upx/upx.git
Unpack: Entire ElfXX_Ehdr must be present in de-compressed Ehdr+Phdrs
https://issues.oss-fuzz.com/u/1/issues/397728078 (previous commit: https://issues.oss-fuzz.com/u/1/issues/397500915) modified: p_lx_elf.cpp
This commit is contained in:
parent
8cce9cf641
commit
e52a3ceb48
|
@ -7674,6 +7674,8 @@ void PackLinuxElf64::unpack(OutputFile *fo)
|
||||||
fi->readx(ibuf, ph.c_len);
|
fi->readx(ibuf, ph.c_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ph.u_len < sizeof(*ehdr))
|
||||||
|
throwCantUnpack("ElfXX_Ehdr corrupted");
|
||||||
decompress(ibuf, (upx_byte *)ehdr, false);
|
decompress(ibuf, (upx_byte *)ehdr, false);
|
||||||
if (ehdr->e_type !=ehdri.e_type
|
if (ehdr->e_type !=ehdri.e_type
|
||||||
|| ehdr->e_machine!=ehdri.e_machine
|
|| ehdr->e_machine!=ehdri.e_machine
|
||||||
|
@ -8885,6 +8887,8 @@ void PackLinuxElf32::unpack(OutputFile *fo)
|
||||||
if (ibuf.getSize() < ph.c_len)
|
if (ibuf.getSize() < ph.c_len)
|
||||||
throwCompressedDataViolation();
|
throwCompressedDataViolation();
|
||||||
fi->readx(ibuf, ph.c_len);
|
fi->readx(ibuf, ph.c_len);
|
||||||
|
if (ph.u_len < sizeof(*ehdr))
|
||||||
|
throwCantUnpack("ElfXX_Ehdr corrupted");
|
||||||
decompress(ibuf, (upx_byte *)ehdr, false);
|
decompress(ibuf, (upx_byte *)ehdr, false);
|
||||||
if (ehdr->e_type !=ehdri.e_type
|
if (ehdr->e_type !=ehdri.e_type
|
||||||
|| ehdr->e_machine!=ehdri.e_machine
|
|| ehdr->e_machine!=ehdri.e_machine
|
||||||
|
|
Loading…
Reference in New Issue