parse: Limit resource table recursion to 3 levels (#77)

This commit is contained in:
William Woodruff 2018-09-21 11:06:08 -04:00 committed by GitHub
parent 19a3bf4859
commit 697714b379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -359,6 +359,15 @@ bool parse_resource_table(bounded_buffer *sectionData,
}
}
}
else {
/* .rsrc can accomodate up to 2**31 levels, but Windows only uses 3 by convention.
* As such, any depth above 3 indicates potentially unchecked recusion.
* See: https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#the-rsrc-section
*/
PE_ERR(PEERR_RESC);
return false;
}
// High bit 0 = RVA to RDT.
// High bit 1 = RVA to RDE.