diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-11-28 10:54:35 +0100 |
---|---|---|
committer | Sean McGovern <gseanmcg@gmail.com> | 2014-04-14 16:55:39 -0400 |
commit | 7e8d27c8510a024e6d66d2e1116bb8692d9cb98a (patch) | |
tree | fcc63e12132784ce8255be96f912b81257d42bc4 | |
parent | 7fd6c9fb49573870b48a995947edc83eedd7e86e (diff) | |
download | ffmpeg-7e8d27c8510a024e6d66d2e1116bb8692d9cb98a.tar.gz |
h264: reset ref count if decoding the slice header fails
Otherwise the ER code might try to use some already freed references.
Fixes possible access to freed memory.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
-rw-r--r-- | libavcodec/h264.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index db336f0fc5..7904e64576 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4137,9 +4137,10 @@ again: context_count = 0; } - if (err < 0) + if (err < 0) { av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n"); - else if (err == 1) { + h->ref_count[0] = h->ref_count[1] = h->list_count = 0; + } else if (err == 1) { /* Slice could not be decoded in parallel mode, copy down * NAL unit stuff to context 0 and restart. Note that * rbsp_buffer is not transferred, but since we no longer |