1
0
mirror of https://github.com/upx/upx.git synced 2025-08-11 22:52:30 +08:00

Prevent leak even if corrupted input

https://issues.oss-fuzz.com/u/1/issues/42531955
	modified:   pefile.cpp
This commit is contained in:
John Reiser
2025-02-27 17:10:52 -08:00
parent 64891286ba
commit 90d86ea59e

View File

@ -1718,6 +1718,8 @@ PeFile::Resource::upx_rnode *PeFile::Resource::convert(const void *rnode, upx_rn
branch->nc = ic;
branch->children = New(upx_rnode *, ic);
branch->data = *node;
if (!root) // first one
root = branch; // prevent leak if xcheck throws (hacked unpack or test)
for (const res_dir_entry *rde = node->entries + ic - 1; --ic >= 0; rde--) {
upx_rnode *child = convert(start + (rde->child & 0x7fffffff), branch, level + 1);