Commit 7d871d1319 for ffmpeg

commit 7d871d13196b3101445416caa6ee9f611793cccc
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Wed Nov 11 05:09:41 2026 +0100

    avcodec/ttaenc: reject sample rates the frame size computation overflows with

    The decoder rejects the same sample rates.

    Fixes: signed integer overflow: 256 * 9000000 cannot be represented in type 'int'
    Fixes: LbmS1VxBslMA

    Found during the triage of a finding from the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25694

    Signed integer overflow Replicated through UnModified FFmpeg with UBSAN

diff --git a/libavcodec/ttaenc.c b/libavcodec/ttaenc.c
index 4bef53a20f..00936863a8 100644
--- a/libavcodec/ttaenc.c
+++ b/libavcodec/ttaenc.c
@@ -54,6 +54,11 @@ static av_cold int tta_encode_init(AVCodecContext *avctx)
         avctx->bits_per_raw_sample = 24;
     }

+    if (avctx->sample_rate > 0x7FFFFF) {
+        av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
+        return AVERROR(EINVAL);
+    }
+
     s->bps = avctx->bits_per_raw_sample >> 3;
     avctx->frame_size = 256 * avctx->sample_rate / 245;