This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/9.0 in repository ffmpeg.
commit f1d2c2d35b0b7808aebc7afca79cc75b8ff5783e Author: Michael Niedermayer <[email protected]> AuthorDate: Wed Oct 14 17:12:12 2026 +0200 Commit: James Almer <[email protected]> CommitDate: Wed Nov 11 12:55:35 2026 -0300 avcodec/lcevcdec: do not enhance a base picture whose format is not the one signalled Fixes: NULL pointer dereference Fixes: ESfSEfFqsNZe/gray8_hevc_420_10bit_1d.hevc Found during triage/review of the security report yOAdvErxaeGg NULL pointer dereference Replicated through UnModified FFmpeg with ASAN Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit 64aeae98089bd6a2e9d46990abbe36fc08c432a7) --- libavcodec/decode.c | 10 ++++++++-- libavcodec/lcevcdec.c | 4 +++- libavcodec/lcevcdec.h | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index ba6ff8a9fd..f70b5e32da 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -101,6 +101,7 @@ typedef struct DecodeContext { FFLCEVCContext *ctx; int frame; enum AVPixelFormat format; + enum AVPixelFormat base_format; int base_width; int base_height; int width; @@ -1647,6 +1648,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) if (dc->lcevc.frame) { ret = ff_lcevc_parse_frame(dc->lcevc.ctx, frame, &dc->lcevc.format, + &dc->lcevc.base_format, &dc->lcevc.width, &dc->lcevc.height); if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) return ret; @@ -1654,7 +1656,8 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) // force get_buffer2() to allocate the base frame using the same dimensions // as the final enhanced frame, in order to prevent reinitializing the buffer // pools unnecessarely - if (!ret && dc->lcevc.width && dc->lcevc.height) { + if (!ret && dc->lcevc.width && dc->lcevc.height && + frame->format == dc->lcevc.base_format) { dc->lcevc.base_width = frame->width; dc->lcevc.base_height = frame->height; frame->width = dc->lcevc.width; @@ -1724,11 +1727,13 @@ int ff_attach_decode_data(AVCodecContext *avctx, AVFrame *frame) if (dc->lcevc.frame) { int ret = ff_lcevc_parse_frame(dc->lcevc.ctx, frame, &dc->lcevc.format, + &dc->lcevc.base_format, &dc->lcevc.width, &dc->lcevc.height); if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) return ret; - if (!ret && dc->lcevc.width && dc->lcevc.height) { + if (!ret && dc->lcevc.width && dc->lcevc.height && + frame->format == dc->lcevc.base_format) { dc->lcevc.base_width = frame->width; dc->lcevc.base_height = frame->height; } else @@ -2400,6 +2405,7 @@ av_cold void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext * dst_dc->lcevc.width = src_dc->lcevc.width; dst_dc->lcevc.height = src_dc->lcevc.height; dst_dc->lcevc.format = src_dc->lcevc.format; + dst_dc->lcevc.base_format = src_dc->lcevc.base_format; #endif } diff --git a/libavcodec/lcevcdec.c b/libavcodec/lcevcdec.c index 043d4e6083..27e4bcd0a2 100644 --- a/libavcodec/lcevcdec.c +++ b/libavcodec/lcevcdec.c @@ -475,7 +475,8 @@ int ff_lcevc_process(void *logctx, AVFrame *frame) } int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const AVFrame *frame, - enum AVPixelFormat *format, int *width, int *height) + enum AVPixelFormat *format, enum AVPixelFormat *base_format, + int *width, int *height) { LCEVCRawProcessBlock *block = NULL; const LCEVCRawGlobalConfig *gc; @@ -498,6 +499,7 @@ int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const AVFrame *frame, gc = block->payload; *format = ff_lcevc_depth_type[gc->enhancement_depth_type][gc->chroma_sampling_type]; + *base_format = ff_lcevc_depth_type[gc->base_depth_type][gc->chroma_sampling_type]; if (gc->resolution_type < 63) { *width = ff_lcevc_resolution_type[gc->resolution_type].width; *height = ff_lcevc_resolution_type[gc->resolution_type].height; diff --git a/libavcodec/lcevcdec.h b/libavcodec/lcevcdec.h index 9371dae772..16f133861c 100644 --- a/libavcodec/lcevcdec.h +++ b/libavcodec/lcevcdec.h @@ -54,6 +54,7 @@ typedef struct FFLCEVCFrame { int ff_lcevc_alloc(FFLCEVCContext **plcevc, int loglevel); int ff_lcevc_process(void *logctx, struct AVFrame *frame); int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const struct AVFrame *frame, - enum AVPixelFormat *format, int *width, int *height); + enum AVPixelFormat *format, enum AVPixelFormat *base_format, + int *width, int *height); #endif /* AVCODEC_LCEVCDEC_H */ -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
