mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-11-03 01:33:50 +08:00
avcodec/cbs_av1_syntax_template: Check ref_frame_idx before use
Fixes: index -1 out of bounds for type 'AV1ReferenceFrameState [8]' Fixes: 16079/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5758807440883712 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> See: [FFmpeg-devel] [PATCH 05/13] avcodec/cbs_av1_syntax_template: Check ref_frame_idx before use Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -419,16 +419,17 @@ static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext *rw,
|
|||||||
for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
|
for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
|
||||||
flags(found_ref[i], 1, i);
|
flags(found_ref[i], 1, i);
|
||||||
if (current->found_ref[i]) {
|
if (current->found_ref[i]) {
|
||||||
AV1ReferenceFrameState *ref =
|
AV1ReferenceFrameState *ref;
|
||||||
&priv->ref[current->ref_frame_idx[i]];
|
|
||||||
|
|
||||||
if (!ref->valid) {
|
if (current->ref_frame_idx[i] < 0 ||
|
||||||
|
!priv->ref[current->ref_frame_idx[i]].valid) {
|
||||||
av_log(ctx->log_ctx, AV_LOG_ERROR,
|
av_log(ctx->log_ctx, AV_LOG_ERROR,
|
||||||
"Missing reference frame needed for frame size "
|
"Missing reference frame needed for frame size "
|
||||||
"(ref = %d, ref_frame_idx = %d).\n",
|
"(ref = %d, ref_frame_idx = %d).\n",
|
||||||
i, current->ref_frame_idx[i]);
|
i, current->ref_frame_idx[i]);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
ref = &priv->ref[current->ref_frame_idx[i]];
|
||||||
|
|
||||||
priv->upscaled_width = ref->upscaled_width;
|
priv->upscaled_width = ref->upscaled_width;
|
||||||
priv->frame_width = ref->frame_width;
|
priv->frame_width = ref->frame_width;
|
||||||
|
|||||||
Reference in New Issue
Block a user