Message ID | 20201025230059.16740-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 718e862da3e254c58447c0873decb335f688fa09 |
Headers | show |
Series | [FFmpeg-devel,1/4] avcodec/av1dec: Check for unset obu instead of crashing | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
On 10/25/2020 8:00 PM, Michael Niedermayer wrote: > Fixes: NULL pointer dereference > Fixes: 26550/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5417762807349248 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/av1dec.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c > index a0a279d65b..bb4295aa6f 100644 > --- a/libavcodec/av1dec.c > +++ b/libavcodec/av1dec.c > @@ -673,7 +673,12 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame, > for (int i = 0; i < s->current_obu.nb_units; i++) { > CodedBitstreamUnit *unit = &s->current_obu.units[i]; > AV1RawOBU *obu = unit->content; > - const AV1RawOBUHeader *header = &obu->header; > + const AV1RawOBUHeader *header; > + > + if (!obu) This looks like a "regression" since ae7686a64f, where ENOSYS (an error code that's not propagated to the caller) on unsupported OBU types is now returned before cbs_av1 even gets a chance to allocate the unit's content. Should be ok. > + continue; > + > + header = &obu->header; > av_log(avctx, AV_LOG_DEBUG, "Obu idx:%d, obu type:%d.\n", i, unit->type); > > switch (unit->type) { >
On Sun, Oct 25, 2020 at 09:00:53PM -0300, James Almer wrote: > On 10/25/2020 8:00 PM, Michael Niedermayer wrote: > > Fixes: NULL pointer dereference > > Fixes: 26550/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5417762807349248 > > > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavcodec/av1dec.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c > > index a0a279d65b..bb4295aa6f 100644 > > --- a/libavcodec/av1dec.c > > +++ b/libavcodec/av1dec.c > > @@ -673,7 +673,12 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame, > > for (int i = 0; i < s->current_obu.nb_units; i++) { > > CodedBitstreamUnit *unit = &s->current_obu.units[i]; > > AV1RawOBU *obu = unit->content; > > - const AV1RawOBUHeader *header = &obu->header; > > + const AV1RawOBUHeader *header; > > + > > + if (!obu) > > This looks like a "regression" since ae7686a64f, where ENOSYS (an error > code that's not propagated to the caller) on unsupported OBU types is > now returned before cbs_av1 even gets a chance to allocate the unit's > content. > > Should be ok. will apply thx [...]
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index a0a279d65b..bb4295aa6f 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -673,7 +673,12 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame, for (int i = 0; i < s->current_obu.nb_units; i++) { CodedBitstreamUnit *unit = &s->current_obu.units[i]; AV1RawOBU *obu = unit->content; - const AV1RawOBUHeader *header = &obu->header; + const AV1RawOBUHeader *header; + + if (!obu) + continue; + + header = &obu->header; av_log(avctx, AV_LOG_DEBUG, "Obu idx:%d, obu type:%d.\n", i, unit->type); switch (unit->type) {
Fixes: NULL pointer dereference Fixes: 26550/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5417762807349248 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/av1dec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)