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

Git pushed a commit to branch master
in repository ffmpeg.

commit 728b70614c87f56a646fe3f7ffe686b3f69b36eb
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Thu Oct 15 03:33:38 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Tue Oct 20 20:41:50 2026 +0000

    avcodec/dvbsubenc: assert that the rect dimensions and nb_colors are in 
range
    
    A negative width, height or nb_colors, or more colors than the 256
    entry palette holds, is caller misuse.
    
    Fixes: tOTDK93gpiC1
    Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24913
---
 libavcodec/dvbsubenc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dvbsubenc.c b/libavcodec/dvbsubenc.c
index 062f93412b..b4d4c8d14f 100644
--- a/libavcodec/dvbsubenc.c
+++ b/libavcodec/dvbsubenc.c
@@ -21,6 +21,7 @@
 #include "avcodec.h"
 #include "bytestream.h"
 #include "codec_internal.h"
+#include "libavutil/avassert.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/opt.h"
 
@@ -302,9 +303,12 @@ static int dvbsub_encode(AVCodecContext *avctx, uint8_t 
*outbuf, int buf_size,
     if (h->num_rects >= 256)
         return AVERROR(EINVAL);
 
-    for (i = 0; i < h->num_rects; i++)
+    for (i = 0; i < h->num_rects; i++) {
+        av_assert0(h->rects[i]->w >= 0 && h->rects[i]->h >= 0 &&
+                   h->rects[i]->nb_colors >= 0 && h->rects[i]->nb_colors <= 
256);
         if (h->rects[i]->w > 0xFFFF || h->rects[i]->h > 0xFFFF)
             return AVERROR(EINVAL);
+    }
 
     if (avctx->width > 0 && avctx->height > 0) {
         if (buf_size < 11)

-- 
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