[Courgette] Add more checks in Win32 PE parsing to fix fuzzer failure.
Recently ClusterFuzz found a number of small PE files that trigger
CHECK failures. This CL makes Courgette PE parsing code more robust,
so more pathological cases can be identified and gracefully handled.
* Check that section headers fit within the image.
* Check that section bodies lie within the image.
* Check that section bodies virtual addresses are bounded by
* Add DisassemblerWin32::IsRvaRangeInBounds() to do this check..
* Check that PE header does not appear too early and cause
* For DisassemblerWin32: In ParseHeader() and QuickDetect():
* Check that ranges of all data read are within image.
Reviewed-by: Samuel Huang <firstname.lastname@example.org>
Reviewed-by: Etienne Pierre-Doray <email@example.com>
Commit-Queue: Samuel Huang <firstname.lastname@example.org>
5 files changed