Commit abea335a76 for ffmpeg
commit abea335a76cb2d5f604f1d381b23aa705984d378
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Thu Nov 12 01:25:37 2026 +0100
avfilter/vf_drawtext: configure the reinit context before releasing the old one
Fixes: NULL pointer dereference
Fixes: bFIbSGRFo5ag
Found during the triage of a finding from the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25800
NULL pointer dereference Replicated through UnModified FFmpeg with ASAN
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index f12c8a7758..ff3eefa3ae 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1222,6 +1222,8 @@ static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char
}
ret = init(ctx);
+ if (ret >= 0)
+ ret = config_input(ctx->inputs[0]);
if (ret < 0) {
uninit(ctx);
ctx->priv = old;
@@ -1236,7 +1238,7 @@ static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char
av_freep(&old);
ctx->priv = new;
- return config_input(ctx->inputs[0]);
+ return 0;
} else {
int old_borderw = old->borderw;
if ((ret = ff_filter_process_command(ctx, cmd, arg, res, res_len, flags)) < 0) {