Commit c989deb9e5 for ffmpeg

commit c989deb9e52042eb6fbeee736e02e3577d9c26f8
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Mon Nov 16 06:56:38 2026 +0100

    avformat/flvdec: apply the concatenation time offset once per tag

    Signed integer overflow Replicated through UnModified FFmpeg with UBSAN

    Fixes: signed integer overflow: -9223372032574423263 + -9223372036854775807 cannot be represented in type 'int64_t' (aka 'long')
    Fixes: 575044121/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-4798271142035456
    Fixes: KrOP5n0Tchcx
    Regression since: e2a8ece352bf72bb05be8e152b1706509706b62a

    Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
    Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index a4d8610d2c..5e742c8dec 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -1565,6 +1565,10 @@ skip:
         goto leave;
     }

+    if (flv->time_pos <= pos) {
+        dts += flv->time_offset;
+    }
+
     for (;;) {
         int track_size = size;
         if (size < 0) {
@@ -1606,10 +1610,6 @@ skip:
         }
         av_log(s, AV_LOG_TRACE, "%d %X %d \n", stream_type, flags, st->discard);

-        if (flv->time_pos <= pos) {
-            dts += flv->time_offset;
-        }
-
         if ((s->pb->seekable & AVIO_SEEKABLE_NORMAL) &&
             ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY ||
              stream_type == FLV_STREAM_TYPE_AUDIO))