Message ID | 20240426235211.3718252-4-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/5] avcodec/pngdec: Check last AVFrame before deref | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
Michael Niedermayer: > Fixes: NULL pointer dereferences > Fixes: 68197/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6382538823106560 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/hevcdec.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index fcfb275f63a..92b0e45eee0 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -1969,13 +1969,13 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0, > > if (current_mv.pred_flag & PF_L0) { > ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; > - if (!ref0 || !ref0->frame->data[0]) > + if (!ref0 || !ref0->frame || !ref0->frame->data[0]) > return; > hevc_await_progress(s, ref0, ¤t_mv.mv[0], y0, nPbH); > } > if (current_mv.pred_flag & PF_L1) { > ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; > - if (!ref1 || !ref1->frame->data[0]) > + if (!ref1 || !ref1->frame || !ref1->frame->data[0]) > return; > hevc_await_progress(s, ref1, ¤t_mv.mv[1], y0, nPbH); > } Same as with 1/5: Checking for !ref0->frame is enough as HEVCFrame.f is set if and only if the HEVCFrame.f->data[0] is set (with the possible exception of hw-accelerated pixel formats that don't use AVFrame.data at all (I don't know whether they exist); in any case, HEVCFrame.f is set if and only if HEVCFrame.f->buf[0] is set). Actually, I checked all the decoder that I ported to ProgressFrames for this pattern, but apparently I overlooked way too much (maybe I only checked for the ->buf[0] pattern?). Sorry for that. - Andreas
On Sat, Apr 27, 2024 at 12:14:18PM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > Fixes: NULL pointer dereferences > > Fixes: 68197/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6382538823106560 > > > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavcodec/hevcdec.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > > index fcfb275f63a..92b0e45eee0 100644 > > --- a/libavcodec/hevcdec.c > > +++ b/libavcodec/hevcdec.c > > @@ -1969,13 +1969,13 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0, > > > > if (current_mv.pred_flag & PF_L0) { > > ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; > > - if (!ref0 || !ref0->frame->data[0]) > > + if (!ref0 || !ref0->frame || !ref0->frame->data[0]) > > return; > > hevc_await_progress(s, ref0, ¤t_mv.mv[0], y0, nPbH); > > } > > if (current_mv.pred_flag & PF_L1) { > > ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; > > - if (!ref1 || !ref1->frame->data[0]) > > + if (!ref1 || !ref1->frame || !ref1->frame->data[0]) > > return; > > hevc_await_progress(s, ref1, ¤t_mv.mv[1], y0, nPbH); > > } > > Same as with 1/5: Checking for !ref0->frame is enough as HEVCFrame.f is > set if and only if the HEVCFrame.f->data[0] is set (with the possible will apply with this simplification thx [...]
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index fcfb275f63a..92b0e45eee0 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -1969,13 +1969,13 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0, if (current_mv.pred_flag & PF_L0) { ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; - if (!ref0 || !ref0->frame->data[0]) + if (!ref0 || !ref0->frame || !ref0->frame->data[0]) return; hevc_await_progress(s, ref0, ¤t_mv.mv[0], y0, nPbH); } if (current_mv.pred_flag & PF_L1) { ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; - if (!ref1 || !ref1->frame->data[0]) + if (!ref1 || !ref1->frame || !ref1->frame->data[0]) return; hevc_await_progress(s, ref1, ¤t_mv.mv[1], y0, nPbH); }
Fixes: NULL pointer dereferences Fixes: 68197/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6382538823106560 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/hevcdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)