Skip to content

Commit

Permalink
#201 Prevent EOF exception trying to read APE header.
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Apr 13, 2019
1 parent 210bbac commit 9b70d7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/apev2/APEv2Parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export class APEv2Parser extends BasicParser {
* @returns {Promise<boolean>} True if tags have been found
*/
public static async parseTagHeader(metadata: INativeMetadataCollector, tokenizer: ITokenizer, options: IOptions): Promise<void> {

if (tokenizer.fileSize && tokenizer.fileSize - tokenizer.position < TagFooter.len) {
debug(`No APEv2 header found, end-of-file reached`);
return;
}

const footer = await tokenizer.peekToken<IFooter>(TagFooter);
if (footer.ID === preamble) {
await tokenizer.ignore(TagFooter.len);
Expand Down

0 comments on commit 9b70d7d

Please sign in to comment.