mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 11:35:38 -04:00
[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:
parent
847342306a
commit
65a3855b98
@ -190,13 +190,14 @@ int NEResourceReaderPrivate::loadResTbl(void)
|
|||||||
int ret = -EIO;
|
int ret = -EIO;
|
||||||
while (pos < rsrc_tbl_size) {
|
while (pos < rsrc_tbl_size) {
|
||||||
// Read the next type ID.
|
// 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...
|
// I/O error; should be at least 2 bytes left...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const NE_TYPEINFO *typeInfo = reinterpret_cast<const NE_TYPEINFO*>(&rsrcTblData[pos]);
|
const NE_TYPEINFO *typeInfo = reinterpret_cast<const NE_TYPEINFO*>(&rsrcTblData[pos]);
|
||||||
const uint16_t rtTypeID = le16_to_cpu(typeInfo->rtTypeID);
|
const uint16_t rtTypeID = le16_to_cpu(typeInfo->rtTypeID);
|
||||||
if (rtTypeID == 0) {
|
if (rtTypeID == 0) {
|
||||||
|
// typeInfo is actually pointing to rscEndTypes.
|
||||||
// End of rscTypes[].
|
// End of rscTypes[].
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user