Skip to content

Commit

Permalink
chd: Check that metadata seek succeeds
Browse files Browse the repository at this point in the history
Prevents an infinite loop if the offset is invalid.
  • Loading branch information
stenzek committed Nov 5, 2024
1 parent fe77cf8 commit 443f3b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libchdr_chd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3123,7 +3123,8 @@ static chd_error metadata_find_entry(chd_file *chd, uint32_t metatag, uint32_t m
uint32_t count;

/* read the raw header */
core_fseek(chd->file, metaentry->offset, SEEK_SET);
if (core_fseek(chd->file, metaentry->offset, SEEK_SET) != 0)
break;
count = core_fread(chd->file, raw_meta_header, sizeof(raw_meta_header));
if (count != sizeof(raw_meta_header))
break;
Expand Down

0 comments on commit 443f3b1

Please sign in to comment.