Commit 7d61ec26c8 for ffmpeg

commit 7d61ec26c8946002222e6d2f2aa08c49b05cfd17
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Sun Oct 11 07:39:11 2026 +0200

    avformat/flacdec: do not flush the parser on a zero length read in flac_read_timestamp()

    A read that returns no data because the input reported EOF transiently
    was passed to the parser as the EOF flush, the data of the next read was
    then parsed by the flushed parser.

    Fixes: NULL pointer dereference
    Fixes: iEqlwpm7chzS
    Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24909
    NULL pointer dereference Replicated through API with ASAN

diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 8d907bdc30..12d4b7305f 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -311,6 +311,10 @@ av_unused static int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde

         if (ret >= 0 || ret == AVERROR(EAGAIN))
             ret = ff_raw_read_partial_packet(s, pkt);
+        if (!ret) {
+            av_packet_unref(pkt);
+            continue;
+        }
         if (ret < 0){
             if (ret == AVERROR(EAGAIN))
                 continue;