[FFmpeg-devel] [PATCH v3] avutil/frame: Use av_realloc_array()

lance.lmwang at gmail.com lance.lmwang at gmail.com
Thu Dec 26 02:33:38 EET 2019


From: Limin Wang <lance.lmwang at gmail.com>

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavutil/frame.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index e403809..2e763ef 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -696,11 +696,8 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
     if (!buf)
         return NULL;
 
-    if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
-        return NULL;
-
-    tmp = av_realloc(frame->side_data,
-                     (frame->nb_side_data + 1) * sizeof(*frame->side_data));
+    tmp = av_realloc_array(frame->side_data,
+                     frame->nb_side_data + 1, sizeof(*frame->side_data));
     if (!tmp)
         return NULL;
     frame->side_data = tmp;
-- 
2.9.5



More information about the ffmpeg-devel mailing list