[FFmpeg-devel] [PATCH 2/2] avutil/video_enc_params: Check for truncation before creating buffer

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sun Feb 14 21:36:16 EET 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavutil/video_enc_params.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c
index b9cdafddbb..635176ab91 100644
--- a/libavutil/video_enc_params.c
+++ b/libavutil/video_enc_params.c
@@ -63,6 +63,10 @@ av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType t
     par = av_video_enc_params_alloc(type, nb_blocks, &size);
     if (!par)
         return NULL;
+    if (size > INT_MAX) {
+        av_free(par);
+        return NULL;
+    }
     buf = av_buffer_create((uint8_t *)par, size, NULL, NULL, 0);
     if (!buf) {
         av_freep(&par);
-- 
2.27.0



More information about the ffmpeg-devel mailing list