mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-16 01:06:09 +00:00
libdfu: Fix hang when parsing corrupt IHEX files
Found by the ever-helpful american fuzzy lop.
This commit is contained in:
parent
644562e291
commit
1d69034f15
@ -184,6 +184,17 @@ dfu_firmware_from_ihex (DfuFirmware *firmware,
|
|||||||
addr32 = ((guint32) addr_high << 16) + addr_low;
|
addr32 = ((guint32) addr_high << 16) + addr_low;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* does not make sense */
|
||||||
|
if (addr32 < addr32_last) {
|
||||||
|
g_set_error (error,
|
||||||
|
DFU_ERROR,
|
||||||
|
DFU_ERROR_INVALID_FILE,
|
||||||
|
"invalid address 0x%x, last was 0x%x",
|
||||||
|
(guint) addr32,
|
||||||
|
(guint) addr32_last);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* parse bytes from line */
|
/* parse bytes from line */
|
||||||
for (i = offset + 9; i < end; i += 2) {
|
for (i = offset + 9; i < end; i += 2) {
|
||||||
/* any holes in the hex record */
|
/* any holes in the hex record */
|
||||||
|
Loading…
Reference in New Issue
Block a user