From a3bfdd7318929fea85872db37aa37f28dddc04d2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 13 Oct 2026 06:39:23 +0200 Subject: [PATCH] avcodec/decode: use avcodec_get_hw_config() in avcodec_default_get_format() This is not a security issue. Fixes: e5BUoyG1Jo3N Fixes: swarm-NULL-pointer-dereference-in-hw_configs-iteration-0b77cc Regression since: 67e81d79cc NULL pointer member access Replicated through API with UBSAN Found-by: zhang xingxing <2388969553@qq.com> Signed-off-by: Michael Niedermayer --- libavcodec/decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 627ad9420a..96da70fb7e 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1019,7 +1019,7 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *avctx, AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)avctx->hw_device_ctx->data; for (i = 0;; i++) { - config = &ffcodec(avctx->codec)->hw_configs[i]->public; + config = avcodec_get_hw_config(avctx->codec, i); if (!config) break; if (!(config->methods &