avutil/frame: Disallow zero sized frame side data
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 23 Feb 2017 14:19:32 +0000 (15:19 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 25 Feb 2017 21:02:23 +0000 (22:02 +0100)
There should be no case that needs this and its a potential for
creating corner cases

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavutil/frame.c

index 8811dcd..69ee240 100644 (file)
@@ -668,6 +668,8 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
                                         enum AVFrameSideDataType type,
                                         int size)
 {
+    if (size <= 0)
+        return NULL;
 
     return frame_new_side_data(frame, type, av_buffer_alloc(size));
 }