[FFmpeg-devel] [PATCH] avfilter/vf_lenscorrection: add assert to ensure there are not more planes than the correction array is large

Michael Niedermayer michaelni at gmx.at
Thu Aug 21 12:34:27 CEST 2014


Exceeding the count would write out of array, and should not occur with any
current pixel format

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavfilter/vf_lenscorrection.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/vf_lenscorrection.c b/libavfilter/vf_lenscorrection.c
index 58184b0..01380fc 100644
--- a/libavfilter/vf_lenscorrection.c
+++ b/libavfilter/vf_lenscorrection.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <math.h>
 
+#include "libavutil/avassert.h"
 #include "libavutil/opt.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/pixdesc.h"
@@ -132,6 +133,8 @@ static int config_props(AVFilterLink *outlink)
     outlink->w = rect->width = inlink->w;
     outlink->h = rect->height = inlink->h;
     rect->nb_planes = av_pix_fmt_count_planes(inlink->format);
+    av_assert0(rect->nb_planes <= FF_ARRAY_ELEMS(rect->correction));
+
     return 0;
 }
 
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list