Macho: Read out of bound feedback
In lief 0.8.3 an out of bound read no longer causes an macho_lief_read_out_of_bound to be raised.
Any way to bring this back or getting a flag that indicates this?
Note: The only was I could tell at the moment that this is happening is by setting debug level, but I need to get this info programatically.
>>> import lief
>>> lief.Logger.set_level(lief.LOGGING_LEVEL.DEBUG)
>>> f = lief.MachO.parse('e4e57c4b31d5b9b01a20d889823c3c503b2603c7704d2714049a071c3af4e464', config=M.ParserConfig.quick)
Parsing MachO
[+] Building Load commands
Offset: 0
Size: 277000
Binary Size: 4ec0
Try to read 0x277000 bytes from 0x0 (277000) which is bigger than the binary's size
>>> f
<_pylief.MachO.FatBinary object at 0x104cd4490>
Yes it's because the exception it catched here: https://github.com/lief-project/LIEF/blob/9d93cc5ec4df6fc71b74497971dbb95d688cc849/src/MachO/Parser.cpp#L123-L137
I was thinking about an API to handle parsing error programatically. The idea is to register parsing errors the the Parser class.
I don't know when this API will be available as I'm not full time on the project
With the new Mach-O parser it should be fixed