acpi-phat: Prevent a corrupt PHAT table from allocating ~4GB of memory

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35761
This commit is contained in:
Richard Hughes 2021-07-02 19:51:54 +01:00
parent 24eec8c533
commit a5de6f0248

View File

@ -88,6 +88,14 @@ fu_acpi_phat_health_record_parse (FuFirmware *firmware,
} else {
ubufsz = dataoff - 28;
}
if (ubufsz > bufsz) {
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_DATA,
"device path too large: 0x%x",
(guint) ubufsz);
return FALSE;
}
/* check this is an even number of bytes */
if (ubufsz % 2 != 0) {