Commit Graph

7 Commits

Author SHA1 Message Date
Richard Hughes
0c51630991 Check firmware magic in a more standard way
Some parsers are ignoring the magic when using _FLAG_IGNORE_CHECKSUM
(which is wrong; fuzzers have no problem with enforcing a static prefix)
and other either disregard the offset or check the magic in an unsafe
way. Also, use FWUPD_ERROR_INVALID_FILE consistently for magic failure.

Add a vfunc, and move all the clever code into one place.
2022-07-14 14:48:15 +01:00
Richard Hughes
0491b07a93 Make the FuFirmware->parse() vfunc more helpful
This removes the 100% unused addr_end parameter and explicitly makes
the addr_start into the start offset in more cases.
2022-06-27 15:40:11 -05:00
Richard Hughes
4b1313b406 Split out the GByte helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
c6581fb7a6 Split out the GByteArray helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
9c7939dae3 trivial: Fix a fuzzing crash for a corrupt IFD image
Sanity check the alignment so we do not write gigabytes of 0xFF's.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39982
2021-10-15 20:05:55 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
488f2e1f37 Export the EFI and IFD parsers
We'll need to use this from another plugin soon.
2021-07-12 10:33:38 +01:00