[FFmpeg-cvslog] avutil/frame: Assert that width/height/ channels is 0 for the destination of av_frame*_ref()

Michael Niedermayer git at videolan.org
Sun Jun 5 17:51:03 CEST 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Mar  8 18:44:34 2016 +0100| [13aae86a2b652360256f52ff292fb2fb0804cbc6] | committer: Michael Niedermayer

avutil/frame: Assert that width/height/channels is 0 for the destination of av_frame*_ref()

This should detect caes where these functions are called in unclean destinations

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

 libavutil/frame.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 5607206..d5c7c9f 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -375,6 +375,9 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src)
 {
     int i, ret = 0;
 
+    av_assert1(dst->width == 0 && dst->height == 0);
+    av_assert1(dst->channels == 0);
+
     dst->format         = src->format;
     dst->width          = src->width;
     dst->height         = src->height;
@@ -504,6 +507,9 @@ void av_frame_unref(AVFrame *frame)
 
 void av_frame_move_ref(AVFrame *dst, AVFrame *src)
 {
+    av_assert1(dst->width == 0 && dst->height == 0);
+    av_assert1(dst->channels == 0);
+
     *dst = *src;
     if (src->extended_data == src->data)
         dst->extended_data = dst->data;



More information about the ffmpeg-cvslog mailing list