Richard Hughes
c3ecec575b
fmap: Use memmem to find the FMAP signature
...
Trust glibc to optimize for the binary search, removing a oss-fuzz detected
crash with our bad pointer maths.
2021-02-11 20:27:20 +00:00
Richard Hughes
a14de30153
trivial: Require <string.h> for strlen() and memcpy()
2020-12-14 16:49:03 +00:00
Richard Hughes
72df114793
fmap: Do not assume FuFmapArea.name is NUL terminated
2020-12-11 14:33:50 +00:00
Richard Hughes
fdea9336a6
fmap: Make mixed-endian safe
2020-12-11 14:33:50 +00:00
Richard Hughes
8b99d4f2ec
fmap: Use fu_memcpy_safe() to prevent buffer over-read
2020-12-11 14:33:50 +00:00
Richard Hughes
531b8b417f
fmap: Fix a critical warning when the FmapArea has zero size
2020-12-10 20:43:54 +00:00
Richard Hughes
976b6afe63
trivial: Allow turning off the FMAP binary search when fuzzing
...
This speeds up the fuzzing task from 22ms to 33us.
2020-12-09 18:08:08 +00:00
Richard Hughes
84617b6699
fmap: Allow writing and reading the image base
2020-12-09 18:02:07 +00:00
Richard Hughes
5771756f85
fmap: Allow creating test firmware from builder.xml
2020-12-09 18:02:07 +00:00
Richard Hughes
a9060f671c
fmap: Correctly check minimum firmware size
2020-12-09 18:02:07 +00:00
Richard Hughes
05e3377d11
trivial: Add fu_common_bytes_new_offset()
...
This is a safer version of g_bytes_new_from_bytes() which returns a GError
if the offsets are invalid rather than emitting a critical warning.
This prevents a critical warning and potential crash when parsing invalid
bcm57xx firmware.
2020-12-08 20:54:25 +00:00
Richard Hughes
fa595a7334
libfwupdplugin: Do not overwrite GError when parsing invalid fmap
2020-12-08 20:32:21 +00:00
Benson Leung
23ca19acf8
fmap-firmware: Parse flashmap format into images
...
Implements a search for the fmap, and follow the map to break the firmware
into the constituent images.
Tested using a servo_micro firmware:
$ fwupdtool firmware-parse servo_micro_v2.4.17-df61092c3.bin
<select fmap option>
FuFmapFirmware:
FuFirmwareImage:
ID: EC_RO
Index: 0x1
Data: 0xf000
FuFirmwareImage:
ID: FR_MAIN
Index: 0x2
Data: 0xf000
FuFirmwareImage:
ID: RO_FRID
Index: 0x3
Address: 0xc4
Data: 0x20
FuFirmwareImage:
ID: FMAP
Index: 0x4
Address: 0x9a40
Version: 1.0
Data: 0x15e
FuFirmwareImage:
ID: WP_RO
Index: 0x5
Data: 0x10000
FuFirmwareImage:
ID: EC_RW
Index: 0x6
Address: 0x10000
Data: 0x10000
FuFirmwareImage:
ID: RW_FWID
Index: 0x7
Address: 0x100c4
Data: 0x20
2020-06-20 07:24:32 +01:00
Benson Leung
acba98bd50
fmap-firmware: Add initial skeleton for fmap
...
fmap is a Google flash layout format that is used in several of Google's
firmware projects, including Chrome OS Embedded Controller and the Chrome OS
coreboot firmwares. Introduce it as a firmware format in libfwupdplugin.
2020-06-20 07:24:32 +01:00