From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 129354E27A for ; Mon, 10 Mar 2025 14:19:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6DB5068E3E8; Mon, 10 Mar 2025 16:19:04 +0200 (EET) Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E15868E2EA for ; Mon, 10 Mar 2025 16:18:58 +0200 (EET) Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5e5bc066283so6592989a12.0 for ; Mon, 10 Mar 2025 07:18:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741616337; x=1742221137; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=x9d/StdpCMyIfJr2mMRVfID5dMATZXMf9jhVATL0RsA=; b=DPvzs4oW1OII7k5SISzdugawvjbgx3NKDAbcsFs3DMXXT8IEmHHIIgv5bd47KYmCcb Ruaw/VVyL3f3I5+JnlViM9pAK2WjzPSO2/FXtS1Osee4KWS+EPW88qqWjE8OL2f59XU5 /Vag8doWw8E5jxKSNI3pUrh9Pna4x294MYbjqOt+mw0mvhH8RxRdRLWPu3vkk0Vc2a7P ZkxRiv4KJSWBmOMetTXf2inp6+/W9mCgUoyzAxOOOALxSXkjHyGVH8qGJ3XRkRoWfiBx SYwburwvfVRIS/c6cXH/m/N5YelkGkvlmeO9Ma6XgfL035G2egFSB/lWAkCrfr4GQwPf bhvw== X-Gm-Message-State: AOJu0YzRLEnnhY5V3PMULUSKtF7Y96rdeROAoMoh4RfB79kmpd/gP1GI RH4wF4Q0jFUUSBeTGCxG2vvk7MamLf3Dr7LTVnpXvhb+JcKP6ShfavT0QPw63ZF6pw/q9iJWcyy juYbMZny+pLKDRhRd6RJ/BAmkEM8WRHS5wVJqLdgZsHlrBOnGRE4ymw== X-Gm-Gg: ASbGncvGGu8QlpZJTTVBtQspW4TyBB2ngiYXpRi7X4Odnj+BSjkLNbT1wHi3oCJwgqb wGx2v55zBTdSzHu9nKOv0u2uXNHEZsRtIdjOBHtNZFmWgR4tYP6MTYJaMmk16501F8fcOnmdL+t WvzPaRkeqIEqizGCJNyXO1IK2x+OWDqAkkfLVK X-Google-Smtp-Source: AGHT+IHTqPjtXD3u8MoqWE+1ffxduu+rIlthOaycetes1P2os9UGMDPV8y7UcSsd2v1vmE2IwBgkKUqsa6i4lC9VW1Y= X-Received: by 2002:a05:6402:2792:b0:5e6:e842:f9be with SMTP id 4fb4d7f45d1cf-5e6e843073dmr5264970a12.18.1741616336708; Mon, 10 Mar 2025 07:18:56 -0700 (PDT) MIME-Version: 1.0 References: <20250303235632.GH4991@pb2> <20250304010937.GJ4991@pb2> <20250308002756.GZ4991@pb2> In-Reply-To: <20250308002756.GZ4991@pb2> Date: Mon, 10 Mar 2025 10:18:44 -0400 X-Gm-Features: AQ5f1JqcUvKUWPUkTcIzd37E55ZLSeeihF6arieK4M_kyljz_8gPmLHQvto-QzY Message-ID: To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="000000000000161266062ffda7b8" Subject: Re: [FFmpeg-devel] [PATCH] libavfilter: guard against ff_draw_init/ff_draw_init2 failures X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Nil Fons Miret via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: Nil Fons Miret Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --000000000000161266062ffda7b8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for the clarification, attaching an updated patch. The only change is the one comment on qrencode.c. Thank you, Nil On Fri, Mar 7, 2025 at 7:28=E2=80=AFPM Michael Niedermayer wrote: > > On Tue, Mar 04, 2025 at 10:17:25AM -0800, Nil Fons Miret via ffmpeg-devel= wrote: > > I'm not sure I understand what documentation you'd like to add. The > > behavior of ff_draw_init* is documented in drawutils.h, would you like > > me to add a comment where these functions are called with no risk of > > failing (as far as I can see, only qrencode.c)? My worry is that such > > a comment can easily become outdated. In any case, once I understand > > your request I'm happy to add any more documentation. > > yes, if you add a check that is unreachable and that is intentional > it should receive a comment. > Otherwise it can confuse the reader, also it can be removed when someone > realizes it is unreachable > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Nations do behave wisely once they have exhausted all other alternatives. > -- Abba Eban > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --000000000000161266062ffda7b8 Content-Type: message/rfc822; name="0001-libavfilter-guard-against-ff_draw_init-ff_draw_init2-f.eml" Content-Disposition: attachment; filename="0001-libavfilter-guard-against-ff_draw_init-ff_draw_init2-f.eml" Content-ID: X-Attachment-Id: f_m835dz2n0 From: Nil Fons Miret Date: Fri, 21 Feb 2025 01:18:21 +0000 Subject: [PATCH] libavfilter: guard against ff_draw_init/ff_draw_init2 failures X-Unsent: 1 To: ffmpeg-devel@ffmpeg.org 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 --- libavfilter/qrencode.c | 27 ++++++++++++++++++++++----- libavfilter/src_avsynctest.c | 7 ++++++- libavfilter/vf_datascope.c | 31 +++++++++++++++++++++++++------ libavfilter/vf_drawtext.c | 6 +++++- libavfilter/vf_pad.c | 6 +++++- libavfilter/vf_shear.c | 7 ++++++- libavfilter/vf_stack.c | 6 +++++- libavfilter/vf_subtitles.c | 16 +++++++++++----- libavfilter/vf_tile.c | 7 ++++++- libavfilter/vf_tinterlace.c | 6 +++++- libavfilter/vf_tpad.c | 7 ++++++- libavfilter/vsrc_testsrc.c | 9 +++++++-- 12 files changed, 109 insertions(+), 26 deletions(-) diff --git a/libavfilter/qrencode.c b/libavfilter/qrencode.c index f96cc8dc93..8c09b605ad 100644 --- a/libavfilter/qrencode.c +++ b/libavfilter/qrencode.c @@ -636,11 +636,20 @@ static int qrencodesrc_config_props(AVFilterLink *outlink) return AVERROR(EINVAL); } - ff_draw_init(&qr->draw, AV_PIX_FMT_ARGB, FF_DRAW_PROCESS_ALPHA); + ret = ff_draw_init(&qr->draw, AV_PIX_FMT_ARGB, FF_DRAW_PROCESS_ALPHA); + if (ret < 0) { + // This call using constants should not fail. Checking its error code for completeness. + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ff_draw_color(&qr->draw, &qr->draw_foreground_color, (const uint8_t *)&qr->foreground_color); ff_draw_color(&qr->draw, &qr->draw_background_color, (const uint8_t *)&qr->background_color); - ff_draw_init2(&qr->draw0, outlink->format, outlink->colorspace, outlink->color_range, FF_DRAW_PROCESS_ALPHA); + ret = ff_draw_init2(&qr->draw0, outlink->format, outlink->colorspace, outlink->color_range, FF_DRAW_PROCESS_ALPHA); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ff_draw_color(&qr->draw0, &qr->draw0_background_color, (const uint8_t *)&qr->background_color); outlink->w = qr->rendered_padded_qrcode_width; @@ -734,8 +743,12 @@ static int qrencode_config_input(AVFilterLink *inlink) qr->is_source = 0; - ff_draw_init2(&qr->draw, inlink->format, inlink->colorspace, inlink->color_range, - FF_DRAW_PROCESS_ALPHA); + ret = ff_draw_init2(&qr->draw, inlink->format, inlink->colorspace, inlink->color_range, + FF_DRAW_PROCESS_ALPHA); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } V(W) = V(main_w) = inlink->w; V(H) = V(main_h) = inlink->h; @@ -764,8 +777,12 @@ static int qrencode_config_input(AVFilterLink *inlink) PARSE_EXPR(rendered_qrcode_width); PARSE_EXPR(rendered_padded_qrcode_width); - ff_draw_init2(&qr->draw, inlink->format, inlink->colorspace, inlink->color_range, + ret = ff_draw_init2(&qr->draw, inlink->format, inlink->colorspace, inlink->color_range, FF_DRAW_PROCESS_ALPHA); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ff_draw_color(&qr->draw, &qr->draw_foreground_color, (const uint8_t *)&qr->foreground_color); ff_draw_color(&qr->draw, &qr->draw_background_color, (const uint8_t *)&qr->background_color); 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]); diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c index 75dc149fbd..6efeb875a6 100644 --- a/libavfilter/vf_datascope.c +++ b/libavfilter/vf_datascope.c @@ -382,11 +382,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int config_input(AVFilterLink *inlink) { - DatascopeContext *s = inlink->dst->priv; + AVFilterContext *ctx = inlink->dst; + DatascopeContext *s = ctx->priv; + uint8_t alpha = s->opacity * 255; + int ret; s->nb_planes = av_pix_fmt_count_planes(inlink->format); - ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->color_range, 0); + ret = ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->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->white, (uint8_t[]){ 255, 255, 255, 255} ); ff_draw_color(&s->draw, &s->black, (uint8_t[]){ 0, 0, 0, alpha} ); ff_draw_color(&s->draw, &s->yellow, (uint8_t[]){ 255, 255, 0, 255} ); @@ -509,10 +516,16 @@ AVFILTER_DEFINE_CLASS(pixscope); static int pixscope_config_input(AVFilterLink *inlink) { - PixscopeContext *s = inlink->dst->priv; + AVFilterContext *ctx = inlink->dst; + PixscopeContext *s = ctx->priv; + int ret; s->nb_planes = av_pix_fmt_count_planes(inlink->format); - ff_draw_init(&s->draw, inlink->format, 0); + ret = ff_draw_init(&s->draw, inlink->format, 0); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ff_draw_color(&s->draw, &s->dark, (uint8_t[]){ 0, 0, 0, s->o * 255} ); ff_draw_color(&s->draw, &s->black, (uint8_t[]){ 0, 0, 0, 255} ); ff_draw_color(&s->draw, &s->white, (uint8_t[]){ 255, 255, 255, 255} ); @@ -927,11 +940,17 @@ static void update_oscilloscope(AVFilterContext *ctx) static int oscilloscope_config_input(AVFilterLink *inlink) { - OscilloscopeContext *s = inlink->dst->priv; + AVFilterContext *ctx = inlink->dst; + OscilloscopeContext *s = ctx->priv; int size; + int ret; s->nb_planes = av_pix_fmt_count_planes(inlink->format); - ff_draw_init(&s->draw, inlink->format, 0); + ret = ff_draw_init(&s->draw, inlink->format, 0); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ff_draw_color(&s->draw, &s->black, (uint8_t[]){ 0, 0, 0, 255} ); ff_draw_color(&s->draw, &s->white, (uint8_t[]){ 255, 255, 255, 255} ); ff_draw_color(&s->draw, &s->green, (uint8_t[]){ 0, 255, 0, 255} ); diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index e4662f3a45..9f5d8d9998 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -1156,7 +1156,11 @@ static int config_input(AVFilterLink *inlink) char *expr; int ret; - ff_draw_init2(&s->dc, inlink->format, inlink->colorspace, inlink->color_range, FF_DRAW_PROCESS_ALPHA); + ret = ff_draw_init2(&s->dc, inlink->format, inlink->colorspace, inlink->color_range, FF_DRAW_PROCESS_ALPHA); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ff_draw_color(&s->dc, &s->fontcolor, s->fontcolor.rgba); ff_draw_color(&s->dc, &s->shadowcolor, s->shadowcolor.rgba); ff_draw_color(&s->dc, &s->bordercolor, s->bordercolor.rgba); diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 49fb272b24..0c7a1d2b44 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -114,7 +114,11 @@ static int config_input(AVFilterLink *inlink) double var_values[VARS_NB], res; char *expr; - ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->color_range, 0); + ret = ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->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->color, s->rgba_color); var_values[VAR_IN_W] = var_values[VAR_IW] = inlink->w; diff --git a/libavfilter/vf_shear.c b/libavfilter/vf_shear.c index f76ed1e4d5..2e558c0044 100644 --- a/libavfilter/vf_shear.c +++ b/libavfilter/vf_shear.c @@ -250,6 +250,7 @@ static int config_output(AVFilterLink *outlink) AVFilterContext *ctx = outlink->src; ShearContext *s = ctx->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format); + int ret; s->nb_planes = av_pix_fmt_count_planes(outlink->format); s->depth = desc->comp[0].depth; @@ -260,7 +261,11 @@ static int config_output(AVFilterLink *outlink) s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(ctx->inputs[0]->h, desc->log2_chroma_h); s->planeheight[0] = s->planeheight[3] = ctx->inputs[0]->h; - 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->color, s->fillcolor); s->filter_slice[0] = s->depth <= 8 ? filter_slice_nn8 : filter_slice_nn16; diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c index 937b87305f..fa202ee0cc 100644 --- a/libavfilter/vf_stack.c +++ b/libavfilter/vf_stack.c @@ -312,7 +312,11 @@ static int config_output(AVFilterLink *outlink) if (s->fillcolor_enable) { const AVFilterLink *inlink = ctx->inputs[0]; - ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->color_range, 0); + ret = ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->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->color, s->fillcolor); } diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index 9f573ec4ed..cf23b7822a 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -182,12 +182,18 @@ static int query_formats(const AVFilterContext *ctx, static int config_input(AVFilterLink *inlink) { - AssContext *ass = inlink->dst->priv; + AVFilterContext *ctx = inlink->dst; + AssContext *ass = ctx->priv; + int ret; - ff_draw_init2(&ass->draw, inlink->format, - ass_get_color_space(ass->track->YCbCrMatrix, inlink->colorspace), - ass_get_color_range(ass->track->YCbCrMatrix, inlink->color_range), - ass->alpha ? FF_DRAW_PROCESS_ALPHA : 0); + ret = ff_draw_init2(&ass->draw, inlink->format, + ass_get_color_space(ass->track->YCbCrMatrix, inlink->colorspace), + ass_get_color_range(ass->track->YCbCrMatrix, inlink->color_range), + ass->alpha ? FF_DRAW_PROCESS_ALPHA : 0); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ass_set_frame_size (ass->renderer, inlink->w, inlink->h); if (ass->original_w && ass->original_h) { diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index 9305123b33..7f2f212c4a 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -128,6 +128,7 @@ static int config_props(AVFilterLink *outlink) FilterLink *ol = ff_filter_link(outlink); const unsigned total_margin_w = (tile->w - 1) * tile->padding + 2*tile->margin; const unsigned total_margin_h = (tile->h - 1) * tile->padding + 2*tile->margin; + int ret; if (inlink->w > (INT_MAX - total_margin_w) / tile->w) { av_log(ctx, AV_LOG_ERROR, "Total width %ux%u is too much.\n", @@ -143,7 +144,11 @@ static int config_props(AVFilterLink *outlink) outlink->h = tile->h * inlink->h + total_margin_h; outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; ol->frame_rate = av_mul_q(il->frame_rate, av_make_q(1, tile->nb_frames - tile->overlap)); - ff_draw_init2(&tile->draw, inlink->format, inlink->colorspace, inlink->color_range, 0); + ret = ff_draw_init2(&tile->draw, inlink->format, inlink->colorspace, inlink->color_range, 0); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } ff_draw_color(&tile->draw, &tile->blank, tile->rgba_color); return 0; diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index de7cd88103..f013891f3e 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -228,7 +228,11 @@ static int config_out_props(AVFilterLink *outlink) if (tinterlace->mode == MODE_PAD) { uint8_t black[4] = { 0, 0, 0, 16 }; - ff_draw_init2(&tinterlace->draw, outlink->format, outlink->colorspace, outlink->color_range, 0); + ret = ff_draw_init2(&tinterlace->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(&tinterlace->draw, &tinterlace->color, black); /* limited range */ if (!ff_fmt_is_in(outlink->format, full_scale_yuvj_pix_fmts)) { diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c index 7ba6fe72bf..f498bf4a3e 100644 --- a/libavfilter/vf_tpad.c +++ b/libavfilter/vf_tpad.c @@ -206,9 +206,14 @@ static int config_input(AVFilterLink *inlink) AVFilterContext *ctx = inlink->dst; FilterLink *l = ff_filter_link(inlink); TPadContext *s = ctx->priv; + int ret; if (needs_drawing(s)) { - ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->color_range, 0); + ret = ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->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->color, s->rgba_color); } diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 71188e624a..f3956a67b1 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -262,8 +262,13 @@ static int color_config_props(AVFilterLink *inlink) TestSourceContext *test = ctx->priv; int ret; - ff_draw_init2(&test->draw, inlink->format, inlink->colorspace, - inlink->color_range, 0); + ret = ff_draw_init2(&test->draw, inlink->format, inlink->colorspace, + inlink->color_range, 0); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to initialize FFDrawContext\n"); + return ret; + } + ff_draw_color(&test->draw, &test->color, test->color_rgba); if (av_image_check_size(test->w, test->h, 0, ctx) < 0) -- 2.47.1 --000000000000161266062ffda7b8 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --000000000000161266062ffda7b8--