Navigation Menu

Skip to content

Commit

Permalink
Fix potential out-of-buffer read while parsing corrupt file, closes #38
Browse files Browse the repository at this point in the history
  • Loading branch information
bfabiszewski committed Sep 18, 2021
1 parent bec783e commit c78e186
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/read.c
Expand Up @@ -752,6 +752,10 @@ MOBI_RET mobi_parse_huffdic(const MOBIData *m, MOBIHuffCdic *huffcdic) {
}
curr = curr->next;
}
if (huffcdic->index_count != huffcdic->index_read) {
debug_print("CDIC: wrong read index count: %zu, total: %zu\n", huffcdic->index_read, huffcdic->index_count);
return MOBI_DATA_CORRUPT;
}
return MOBI_SUCCESS;
}

Expand Down

0 comments on commit c78e186

Please sign in to comment.