[FFmpeg-cvslog] lavc/libx264: do not leave an invalid array size on alloc error

Anton Khirnov git at videolan.org
Wed Jan 4 13:13:35 EET 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Nov 27 11:22:44 2022 +0100| [7399e5305ca9a77ea4d3ffa692477a330d7d2c08] | committer: Anton Khirnov

lavc/libx264: do not leave an invalid array size on alloc error

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7399e5305ca9a77ea4d3ffa692477a330d7d2c08
---

 libavcodec/libx264.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index a1b044d4e9..2bbd9044b6 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -1107,8 +1107,10 @@ static av_cold int X264_init(AVCodecContext *avctx)
     x4->nb_reordered_opaque = x264_encoder_maximum_delayed_frames(x4->enc) + 17;
     x4->reordered_opaque    = av_calloc(x4->nb_reordered_opaque,
                                         sizeof(*x4->reordered_opaque));
-    if (!x4->reordered_opaque)
+    if (!x4->reordered_opaque) {
+        x4->nb_reordered_opaque = 0;
         return AVERROR(ENOMEM);
+    }
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list