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 09ec2b397a avcodec/exr: use av_realloc_array()
09ec2b397a is described below

commit 09ec2b397a16de1a8016c33cdb84301b3f5e48e4
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Thu Jan 15 02:47:06 2026 +0100
Commit:     michaelni <[email protected]>
CommitDate: Mon Jan 19 20:41:04 2026 +0000

    avcodec/exr: use av_realloc_array()
    
    Related to: #YWH-PGM40646-33
    See: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21347
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/exr.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 536a55c5be..7dcd19b2a5 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1807,12 +1807,17 @@ static int decode_header(EXRContext *s, AVFrame *frame)
                     }
                 }
 
-                s->channels = av_realloc(s->channels,
-                                         ++s->nb_channels * 
sizeof(EXRChannel));
-                if (!s->channels) {
+                av_assert0(s->nb_channels < INT_MAX); // Impossible due to 
size of the bitstream
+                EXRChannel *new_channels = av_realloc_array(s->channels,
+                                                            s->nb_channels + 1,
+                                                            
sizeof(EXRChannel));
+                if (!new_channels) {
                     ret = AVERROR(ENOMEM);
                     goto fail;
                 }
+                s->nb_channels ++;
+                s->channels = new_channels;
+
                 channel             = &s->channels[s->nb_channels - 1];
                 channel->pixel_type = current_pixel_type;
                 channel->xsub       = xsub;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to