1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avcodec/ratecontrol: check the fcode and bcode of the 2-pass log

Fixes: out of array access
Fixes: DY618nKRv9YY
Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24758
Out of array access Replicated through UnModified FFmpeg with ASAN
This commit is contained in:
Michael Niedermayer
2026-10-12 02:07:46 +02:00
committed by michaelni
parent 863ca906a1
commit 4faaf2e9b8

View File

@@ -635,6 +635,11 @@ av_cold int ff_rate_control_init(MPVMainEncContext *const m)
rce->pict_type, i);
return -1;
}
if ((unsigned)rce->f_code > MAX_FCODE || (unsigned)rce->b_code > MAX_FCODE) {
av_log(avctx, AV_LOG_ERROR, "invalid fcode %d / bcode %d at line %d\n",
rce->f_code, rce->b_code, i);
return -1;
}
p = next;
}