From 0a885895adc304249b0a89f4560e3a13d668e1c7 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Tue, 29 Oct 2024 15:47:56 +0100 Subject: [PATCH 1/2] Fix end-of-stream signal not being propagated Credit: Oss-Fuzz Issue: https://issues.oss-fuzz.com/issues/370597904 --- src/libFLAC/ogg_decoder_aspect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libFLAC/ogg_decoder_aspect.c b/src/libFLAC/ogg_decoder_aspect.c index 8e88ec6c4f..8e8b65635b 100644 --- a/src/libFLAC/ogg_decoder_aspect.c +++ b/src/libFLAC/ogg_decoder_aspect.c @@ -654,7 +654,7 @@ FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_skip_link(FLAC__OggDec return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC; aspect->current_linknumber--; aspect->linkdetails[aspect->current_linknumber].is_last = true; - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK; + return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM; } else { /* We can end up here for three reasons: From 8f44597c49d17d4765a56b8d66f3e1f84aa0d2a7 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Tue, 29 Oct 2024 15:59:05 +0100 Subject: [PATCH 2/2] Fix -Wunused-result warning for ID3v1 detection --- src/flac/decode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/flac/decode.c b/src/flac/decode.c index 16c3ccdf36..a384b8c030 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);