diff options
author | Nil Fons Miret <[email protected]> | 2025-02-21 01:18:21 +0000 |
---|---|---|
committer | Michael Niedermayer <[email protected]> | 2025-03-11 14:17:01 +0100 |
commit | 9899da8175f059aa8bf21e45ad1b5e7cfd33b786 (patch) | |
tree | 8fcde38cefed933102af93a7ef2057bcf76497f8 /libavfilter/src_avsynctest.c | |
parent | bdc07f372ac14ad9cb6d4f7f356d4c7a47c251fe (diff) |
libavfilter: guard against ff_draw_init/ff_draw_init2 failures
The return value of ff_draw_init and ff_draw_init2 are not checked in
most usages. However, if they return an error, they don't get to the
point where they set the attributes of the FFDrawContext. These
functions are typically used in conjunction with ff_draw_color, which
checks draw->desc->flags, causing a null pointer dereference.
Signed-off-by: Nil Fons Miret <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
Diffstat (limited to 'libavfilter/src_avsynctest.c')
-rw-r--r-- | libavfilter/src_avsynctest.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavfilter/src_avsynctest.c b/libavfilter/src_avsynctest.c index 6f42137f49..68dffba43a 100644 --- a/libavfilter/src_avsynctest.c +++ b/libavfilter/src_avsynctest.c @@ -147,6 +147,7 @@ static av_cold int config_props(AVFilterLink *outlink) FilterLink *l = ff_filter_link(outlink); AVFilterContext *ctx = outlink->src; AVSyncTestContext *s = ctx->priv; + int ret; outlink->w = s->w; outlink->h = s->h; @@ -160,7 +161,11 @@ static av_cold int config_props(AVFilterLink *outlink) s->dir = 1; s->prev_intpart = INT64_MIN; - ff_draw_init2(&s->draw, outlink->format, outlink->colorspace, outlink->color_range, 0); + ret = ff_draw_init2(&s->draw, outlink->format, outlink->colorspace, outlink->color_range, 0); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ff_draw_color(&s->draw, &s->fg, s->rgba[0]); ff_draw_color(&s->draw, &s->bg, s->rgba[1]); |