Browse code

avfilter/drawutils: Assert av_pix_fmt_desc_get() return value in ff_fill_line_with_color()

Theres currently no case where this could be triggered

Found-by: Daemon404
Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/06/13 06:40:09
Showing 1 changed files
... ...
@@ -21,6 +21,7 @@
21 21
 
22 22
 #include <string.h>
23 23
 
24
+#include "libavutil/avassert.h"
24 25
 #include "libavutil/avutil.h"
25 26
 #include "libavutil/colorspace.h"
26 27
 #include "libavutil/mem.h"
... ...
@@ -66,7 +67,11 @@ int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t
66 66
     uint8_t rgba_map[4] = {0};
67 67
     int i;
68 68
     const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt);
69
-    int hsub = pix_desc->log2_chroma_w;
69
+    int hsub;
70
+
71
+    av_assert0(pix_desc);
72
+
73
+    hsub = pix_desc->log2_chroma_w;
70 74
 
71 75
     *is_packed_rgba = ff_fill_rgba_map(rgba_map, pix_fmt) >= 0;
72 76