[libromdata] NEResourceReaderPrivate::loadResTbl(): Fix an off-by-one error that broke reading resources from SkiFree 1.0.

SkiFree doesn't have any named resources, so its resource table ends
immediately after rscEndTypes. The off-by-one prevented us from
recognizing the presence of rscEndTypes.

SKI.EXE can now be thumbnailed.
This commit is contained in:
David Korth 2025-06-09 18:11:03 -04:00
parent 847342306a
commit 65a3855b98

View File

@ -190,13 +190,14 @@ int NEResourceReaderPrivate::loadResTbl(void)
int ret = -EIO;
while (pos < rsrc_tbl_size) {
// Read the next type ID.
if ((pos + 2) >= rsrc_tbl_size) {
if ((pos + 2) > rsrc_tbl_size) {
// I/O error; should be at least 2 bytes left...
break;
}
const NE_TYPEINFO *typeInfo = reinterpret_cast<const NE_TYPEINFO*>(&rsrcTblData[pos]);
const uint16_t rtTypeID = le16_to_cpu(typeInfo->rtTypeID);
if (rtTypeID == 0) {
// typeInfo is actually pointing to rscEndTypes.
// End of rscTypes[].
ret = 0;
break;