This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 60795d2f6e1b5a5a9a9362975635f787ae008e67 Author: Michael Niedermayer <[email protected]> AuthorDate: Sat Oct 10 04:55:21 2026 +0200 Commit: michaelni <[email protected]> CommitDate: Mon Oct 12 23:55:55 2026 +0000 avcodec/imm5: switch to the receive_frame API Pull packets with ff_decode_get_packet() and receive from the sub-decoder until it has no frame left before feeding it the next packet. This also drains the sub-decoder at EOF instead of dropping its delayed frames. Assertion failure Replicated through API Fixes: assertion failure Fixes: 538301564/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IMM5_fuzzer-5256353978580992 Fixes: PFQtJZPcOsLc Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]> --- libavcodec/imm5.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c index d130db76ae..1ca9972e0f 100644 --- a/libavcodec/imm5.c +++ b/libavcodec/imm5.c @@ -24,10 +24,13 @@ #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" +#include "internal.h" typedef struct IMM5Context { AVCodecContext *h264_avctx; // wrapper context for H264 AVCodecContext *hevc_avctx; // wrapper context for HEVC + AVCodecContext *codec_avctx; } IMM5Context; static const struct IMM5_unit { @@ -66,6 +69,7 @@ static av_cold int imm5_init(AVCodecContext *avctx) ret = avcodec_open2(ctx->h264_avctx, NULL, NULL); if (ret < 0) return ret; + ctx->codec_avctx = ctx->h264_avctx; EXTERN const FFCodec ff_hevc_decoder; ctx->hevc_avctx = avcodec_alloc_context3(&ff_hevc_decoder.p); @@ -82,8 +86,7 @@ static av_cold int imm5_init(AVCodecContext *avctx) return 0; } -static int imm5_decode_frame(AVCodecContext *avctx, AVFrame *frame, - int *got_frame, AVPacket *avpkt) +static int imm5_send_packet(AVCodecContext *avctx, AVPacket *avpkt) { IMM5Context *ctx = avctx->priv_data; AVCodecContext *codec_avctx = ctx->h264_avctx; @@ -131,18 +134,36 @@ static int imm5_decode_frame(AVCodecContext *avctx, AVFrame *frame, } } + ctx->codec_avctx = codec_avctx; ret = avcodec_send_packet(codec_avctx, avpkt); - if (ret < 0) { + if (ret < 0) av_log(avctx, AV_LOG_ERROR, "Error submitting a packet for decoding\n"); - return ret; - } + return ret; +} + +static int imm5_receive_frame(AVCodecContext *avctx, AVFrame *frame) +{ + IMM5Context *ctx = avctx->priv_data; + AVPacket *avpkt = avctx->internal->in_pkt; + int ret; - ret = avcodec_receive_frame(codec_avctx, frame); - if (ret == AVERROR(EAGAIN)) - return avpkt->size; + while ((ret = avcodec_receive_frame(ctx->codec_avctx, frame)) == AVERROR(EAGAIN)) { + ret = ff_decode_get_packet(avctx, avpkt); + if (ret == AVERROR_EOF) { + avcodec_send_packet(ctx->codec_avctx, NULL); + continue; + } + if (ret < 0) + return ret; + ret = imm5_send_packet(avctx, avpkt); + av_packet_unref(avpkt); + if (ret < 0) + return ret; + } if (ret < 0) return ret; + AVCodecContext *codec_avctx = ctx->codec_avctx; avctx->pix_fmt = codec_avctx->pix_fmt; avctx->coded_width = codec_avctx->coded_width; avctx->coded_height = codec_avctx->coded_height; @@ -155,9 +176,7 @@ static int imm5_decode_frame(AVCodecContext *avctx, AVFrame *frame, avctx->color_primaries = codec_avctx->color_primaries; avctx->chroma_sample_location = codec_avctx->chroma_sample_location; - *got_frame = 1; - - return avpkt->size; + return 0; } static av_cold void imm5_flush(AVCodecContext *avctx) @@ -183,8 +202,9 @@ const FFCodec ff_imm5_decoder = { CODEC_LONG_NAME("Infinity IMM5"), .p.type = AVMEDIA_TYPE_VIDEO, .p.id = AV_CODEC_ID_IMM5, + .p.capabilities = AV_CODEC_CAP_DELAY, .init = imm5_init, - FF_CODEC_DECODE_CB(imm5_decode_frame), + FF_CODEC_RECEIVE_FRAME_CB(imm5_receive_frame), .close = imm5_close, .flush = imm5_flush, .priv_data_size = sizeof(IMM5Context), -- 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]
