diff --git a/src/flac/decode.c b/src/flac/decode.c index 16c3ccdf..a384b8c0 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -349,9 +349,7 @@ FLAC__bool DecoderSession_init_decoder(DecoderSession *decoder_session, const ch return false; } } - fseek(f, -128, SEEK_END); /* Do not check for errors, because it could be that file is less than 128 bytes long */ - fread(buffer, 1, 3, f); - if(memcmp(buffer, "TAG", 3) == 0){ + if(fseek(f, -128, SEEK_END) == 0 && fread(buffer, 1, 3, f) == 3 && memcmp(buffer, "TAG", 3) == 0){ flac__utils_printf(stderr, 1, "%s: NOTE, found something that looks like an ID3v1 tag. If decoding returns an error, this ID3v1 tag is probably the cause.\n", decoder_session->inbasefilename); } fclose(f);