bootimage: Fix panic when validating vendor v4 table size

The multiplication can overflow.

(Found by honggfuzz)

Issue: #160

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This commit is contained in:
Andrew Gunnerson
2023-09-26 23:47:50 -04:00
parent 07f2e30430
commit f85b6eec46
+1 -1
View File
@@ -1020,7 +1020,7 @@ impl<R: Read> FromReader<R> for VendorBootImageV3Through4 {
"vendor_ramdisk_table_entry_size",
table_entry_size,
));
} else if table_size != table_entry_num * table_entry_size {
} else if table_entry_num.checked_mul(table_entry_size) != Some(table_size) {
return Err(Error::InvalidFieldValue(
"vendor_ramdisk_table_size",
table_size,