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 a0410859ec avcodec/diracdec: retain HQ scratch buffer on allocation 
failure
a0410859ec is described below

commit a0410859ec4a4361eb0835de508f7ec5e9313d2b
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Thu Nov 5 23:59:22 2026 +0000
Commit:     Lynne <[email protected]>
CommitDate: Sat Nov 7 06:05:39 2026 +0000

    avcodec/diracdec: retain HQ scratch buffer on allocation failure
    
    Keep the existing scratch buffer and its published extents if resizing 
fails. Use av_realloc_array(), which leaves the old allocation intact, and 
commit the pointer and extents only after success. This allows decoding to 
retry the allocation on a later picture without using a null scratch buffer.
    
    Fixes: #24188
    
    Assisted-by: Fairy
---
 libavcodec/diracdec.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index aa54dbaff2..719eeaaaf9 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -958,13 +958,15 @@ static int decode_lowdelay(DiracContext *s)
 
     if (s->threads_num_buf != avctx->thread_count ||
         s->thread_buf_size != coef_buf_size) {
-        s->threads_num_buf  = avctx->thread_count;
-        s->thread_buf_size  = coef_buf_size;
-        s->thread_buf       = av_realloc_f(s->thread_buf, avctx->thread_count, 
s->thread_buf_size);
-        if (!s->thread_buf) {
+        uint8_t *thread_buf = av_realloc_array(s->thread_buf, 
avctx->thread_count,
+                                               coef_buf_size);
+        if (!thread_buf) {
             av_log(s->avctx, AV_LOG_ERROR, "thread buffer allocation 
failure\n");
             return AVERROR(ENOMEM);
         }
+        s->thread_buf = thread_buf;
+        s->threads_num_buf = avctx->thread_count;
+        s->thread_buf_size = coef_buf_size;
     }
 
     align_get_bits(&s->gb);

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