X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fdrawutils.c;h=5a82b10cd643da309cf405ddcd5a3c9110932f3f;hb=4a5074d7987e985645484c269e6f01faeec62da5;hp=0b2f17e52aa4351593989b0575e429436a474afe;hpb=00ebf89dcdeb0587eba80ebd634591873f64624a;p=ffmpeg diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c index 0b2f17e52aa..5a82b10cd64 100644 --- a/libavfilter/drawutils.c +++ b/libavfilter/drawutils.c @@ -21,6 +21,7 @@ #include +#include "libavutil/avassert.h" #include "libavutil/avutil.h" #include "libavutil/colorspace.h" #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 uint8_t rgba_map[4] = {0}; int i; const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt); - int hsub = pix_desc->log2_chroma_w; + int hsub; + + av_assert0(pix_desc); + + hsub = pix_desc->log2_chroma_w; *is_packed_rgba = ff_fill_rgba_map(rgba_map, pix_fmt) >= 0; @@ -160,7 +165,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) unsigned i, nb_planes = 0; int pixelstep[MAX_PLANES] = { 0 }; - if (!desc->name) + if (!desc || !desc->name) return AVERROR(EINVAL); if (desc->flags & ~(AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL | AV_PIX_FMT_FLAG_ALPHA)) return AVERROR(ENOSYS);