Skip to content

Commit 09fa975

Browse files
committed
chd: Check that metadata seek succeeds
Prevents an infinite loop if the offset is invalid.
1 parent 70cfcbe commit 09fa975

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libchdr_chd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3144,7 +3144,8 @@ static chd_error metadata_find_entry(chd_file *chd, uint32_t metatag, uint32_t m
31443144
uint32_t count;
31453145

31463146
/* read the raw header */
3147-
core_fseek(chd->file, metaentry->offset, SEEK_SET);
3147+
if (core_fseek(chd->file, metaentry->offset, SEEK_SET) != 0)
3148+
break;
31483149
count = core_fread(chd->file, raw_meta_header, sizeof(raw_meta_header));
31493150
if (count != sizeof(raw_meta_header))
31503151
break;

0 commit comments

Comments
 (0)