Make sure to wrap all uses of kaitai::kstream into try-catch blocks

This commit is contained in:
Nikolaj Schlej 2025-03-16 23:37:10 +07:00
parent 7ef371957a
commit d61d759db2

View file

@ -953,6 +953,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index)
} }
} }
else if (itemType == Types::InsydeFlashDeviceMapStore) { else if (itemType == Types::InsydeFlashDeviceMapStore) {
try {
UByteArray fdm = data.mid(itemOffset, itemSize); UByteArray fdm = data.mid(itemOffset, itemSize);
umemstream is(fdm.constData(), fdm.size()); umemstream is(fdm.constData(), fdm.size());
kaitai::kstream ks(&is); kaitai::kstream ks(&is);
@ -1060,6 +1061,10 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index)
securityInfo += "\n"; securityInfo += "\n";
} }
} }
catch (...) {
// Parsing failed
}
}
else { else {
return U_UNKNOWN_ITEM_TYPE; return U_UNKNOWN_ITEM_TYPE;
} }