This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 12c589a37d avcodec/tdsc: validate the cursor dimensions before storing 
them
12c589a37d is described below

commit 12c589a37d093cc55618f8377b092dc21416806f
Author:     David Korczynski <[email protected]>
AuthorDate: Thu Sep 24 21:52:40 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sat Oct 3 23:19:15 2026 +0000

    avcodec/tdsc: validate the cursor dimensions before storing them
    
    Fixes: heap-buffer-overflow (read)
    Fixes: xU5xVR9zXRej
    Fixes: ANT-2026-K32Z5S4E-tdsc-cursor.avi
    Found-by: Claude and Ada Logics
---
 libavcodec/tdsc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/libavcodec/tdsc.c b/libavcodec/tdsc.c
index 102b4ae966..f31655ce3d 100644
--- a/libavcodec/tdsc.c
+++ b/libavcodec/tdsc.c
@@ -199,24 +199,23 @@ static void tdsc_paint_cursor(AVCodecContext *avctx, 
uint8_t *dst, int stride)
 static int tdsc_load_cursor(AVCodecContext *avctx)
 {
     TDSCContext *ctx  = avctx->priv_data;
-    int i, j, k, ret, cursor_fmt;
+    int i, j, k, ret, cursor_fmt, w, h;
     uint8_t *dst;
 
     ctx->cursor_hot_x = bytestream2_get_le16(&ctx->gbc);
     ctx->cursor_hot_y = bytestream2_get_le16(&ctx->gbc);
-    ctx->cursor_w     = bytestream2_get_le16(&ctx->gbc);
-    ctx->cursor_h     = bytestream2_get_le16(&ctx->gbc);
+    w                 = bytestream2_get_le16(&ctx->gbc);
+    h                 = bytestream2_get_le16(&ctx->gbc);
 
-    ctx->cursor_stride = FFALIGN(ctx->cursor_w, 32) * 4;
     cursor_fmt = bytestream2_get_le32(&ctx->gbc);
 
-    if (ctx->cursor_w < 1 || ctx->cursor_w > 256 ||
-        ctx->cursor_h < 1 || ctx->cursor_h > 256) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Invalid cursor dimensions %dx%d.\n",
-               ctx->cursor_w, ctx->cursor_h);
+    if (w < 1 || w > 256 || h < 1 || h > 256) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid cursor dimensions %dx%d.\n", w, 
h);
         return AVERROR_INVALIDDATA;
     }
+    ctx->cursor_w      = w;
+    ctx->cursor_h      = h;
+    ctx->cursor_stride = FFALIGN(w, 32) * 4;
     if (ctx->cursor_hot_x > ctx->cursor_w ||
         ctx->cursor_hot_y > ctx->cursor_h) {
         av_log(avctx, AV_LOG_WARNING, "Invalid hotspot position %d.%d.\n",

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to