[FFmpeg-cvslog] avcodec/rv60dec: Check NEXT/LAST availability
Michael Niedermayer
git at videolan.org
Tue Dec 24 04:45:32 EET 2024
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Dec 8 02:07:52 2024 +0100| [61ff3047c577372cb3890b0e0eb6f556c0f8de8c] | committer: Michael Niedermayer
avcodec/rv60dec: Check NEXT/LAST availability
Fixes: NULL ptr use
Fixes: 378634700/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_fuzzer-5008344043028480
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross at xvid.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61ff3047c577372cb3890b0e0eb6f556c0f8de8c
---
libavcodec/rv60dec.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/libavcodec/rv60dec.c b/libavcodec/rv60dec.c
index 4cc71dcd6e..0c2e03d737 100644
--- a/libavcodec/rv60dec.c
+++ b/libavcodec/rv60dec.c
@@ -61,7 +61,7 @@ enum IntraMode {
};
enum MVRefEnum {
- MVREF_NONE,
+ MVREF_NONE = 0,
MVREF_REF0,
MVREF_REF1,
MVREF_BREF,
@@ -1745,15 +1745,24 @@ static int decode_cu_r(RV60Context * s, AVFrame * frame, ThreadContext * thread,
bx = mv_x << 2;
by = mv_y << 2;
+ if (!(mv.mvref & 2)) {
+ if (!s->last_frame[LAST_PIC]->data[0]) {
+ av_log(s->avctx, AV_LOG_ERROR, "missing reference frame\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ if (mv.mvref & 6) {
+ if (!s->last_frame[NEXT_PIC]->data[0]) {
+ av_log(s->avctx, AV_LOG_ERROR, "missing reference frame\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
switch (mv.mvref) {
case MVREF_REF0:
mc(s, frame->data, frame->linesize, s->last_frame[LAST_PIC], bx, by, bw, bh, mv.f_mv, 0);
break;
case MVREF_REF1:
- if (!s->last_frame[NEXT_PIC]->data[0]) {
- av_log(s->avctx, AV_LOG_ERROR, "missing reference frame\n");
- return AVERROR_INVALIDDATA;
- }
mc(s, frame->data, frame->linesize, s->last_frame[NEXT_PIC], bx, by, bw, bh, mv.f_mv, 0);
break;
case MVREF_BREF:
More information about the ffmpeg-cvslog
mailing list