summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-28 10:54:35 +0100
committerAnton Khirnov <anton@khirnov.net>2014-01-18 20:51:04 +0100
commit0652e024c680420d298cdf3719d0a0c030173fe3 (patch)
tree8b50932a15b0ff745ee271d38acd7da504f7c759 /libavcodec
parent98cc9efc5f6b4dc847ed3b9b60b1c3bcd14e6791 (diff)
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
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index ed5aea8e1a..6f329aacb3 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -4813,9 +4813,10 @@ again:
context_count = 0;
}
- if (err < 0)
+ if (err < 0) {
av_log(h->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