diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-01-27 00:14:02 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-01-27 00:52:49 +0100 |
commit | f28299da8d06f0f3fe0195edff727b246d0a34cf (patch) | |
tree | d617355a032cb6d94e3082ad672e97932449bbfe | |
parent | 1ae39429e4c4ed2d5bdf9452441930e4c54f258e (diff) |
avcodec/h264dec: Clear ref_count on slice header processing failure
Fixes using freed memory
Introduced in 744801989099df26e90b00062c645969c5347533
Fixes: 471/fuzz-1-ffmpeg_VIDEO_AV_CODEC_ID_H264_fuzzer
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/h264dec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 31db1db076..0994b83f81 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -670,8 +670,11 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) case H264_NAL_SLICE: h->has_slice = 1; - if ((err = ff_h264_queue_decode_slice(h, nal))) + if ((err = ff_h264_queue_decode_slice(h, nal))) { + H264SliceContext *sl = h->slice_ctx + h->nb_slice_ctx_queued; + sl->ref_count[0] = sl->ref_count[1] = 0; break; + } if (h->current_slice == 1) { if (avctx->active_thread_type & FF_THREAD_FRAME && !h->avctx->hwaccel && |