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

Git pushed a commit to branch release/9.1
in repository ffmpeg.

commit bfba881039265b36a47e596283ccdf1664a42928
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Mon Nov 16 19:16:28 2026 +0100
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Thu Nov 19 14:55:43 2026 +0100

    avcodec/pgssubdec: allocate the object buffer as the object data arrives
    
    Fixes: excessive memory allocation
    Fixes: arH7mH3swjtk
    Fixes: acf_d0c5bc7e8a9c409c5d914a42bbae06af
    
    Excessive memory allocation Replicated through UnModified FFmpeg with GNU 
time (maximum resident set size)
    no further issues found with 26841009 iterations of tools/target_dec_fuzzer
    
    (cherry picked from commit 2063837162cda7c995a542723f013fdf69586711)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/pgssubdec.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index af1c9536d8..3addd5a756 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -265,7 +265,14 @@ static int parse_object_segment(AVCodecContext *avctx,
         if (buf_size > object->rle_remaining_len)
             return AVERROR_INVALIDDATA;
 
+        uint8_t *rle = av_fast_realloc(object->rle, &object->rle_buffer_size,
+                                       object->rle_data_len + buf_size + 
AV_INPUT_BUFFER_PADDING_SIZE);
+        if (!rle)
+            return AVERROR(ENOMEM);
+        object->rle = rle;
+
         memcpy(object->rle + object->rle_data_len, buf, buf_size);
+        memset(object->rle + object->rle_data_len + buf_size, 0, 
AV_INPUT_BUFFER_PADDING_SIZE);
         object->rle_data_len += buf_size;
         object->rle_remaining_len -= buf_size;
 
@@ -299,7 +306,7 @@ static int parse_object_segment(AVCodecContext *avctx,
     object->w = width;
     object->h = height;
 
-    av_fast_padded_malloc(&object->rle, &object->rle_buffer_size, 
rle_bitmap_len);
+    av_fast_padded_malloc(&object->rle, &object->rle_buffer_size, buf_size);
 
     if (!object->rle) {
         object->rle_data_len = 0;

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