Skip to content

Commit a75da21

Browse files
committed
[libromdata] EXEPrivate::findNERuntimeDLL(): Properly fix the bounds check.
If count == 0, skip the name, since it's guaranteed to be empty.
1 parent 869ae09 commit a75da21

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libromdata/Other/EXE_NE.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ int EXEPrivate::findNERuntimeDLL(string &refDesc, string &refLink, bool &refHasK
259259
}
260260

261261
const uint8_t count = static_cast<uint8_t>(ne_imported_name_table[nameOffset]);
262+
assert(count > 0);
263+
if (count == 0) {
264+
// Empty name?
265+
continue;
266+
}
267+
262268
assert(nameOffset + 1 + count <= ne_imported_name_table.size());
263269
if (nameOffset + 1 + count > ne_imported_name_table.size()) {
264270
// Out of range.

0 commit comments

Comments
 (0)