aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-28 10:54:35 +0100
committerSean McGovern <gseanmcg@gmail.com>2014-04-14 16:55:38 -0400
commit1147d39bca135df8673031d16989ba486a52172a (patch)
treefb42c91d22c7a7d2c079fc65acb784504745f76d
parent30e58e65e543d04d5e52bf188b31abf4dd41a104 (diff)
downloadffmpeg-1147d39bca135df8673031d16989ba486a52172a.tar.gz
h264: reset data_partitioning if decoding the slice header for NAL_DPA fails
If it was set before then we can end up trying to decode a slice without a valid slice header, which can lead to invalid memory access. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org (cherry picked from commit 58312b2472d3a44d7458865c459d59ef2e02bf1a)
-rw-r--r--libavcodec/h264.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 20fa82cae2..7acc5a7019 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -4061,8 +4061,13 @@ again:
hx->intra_gb_ptr =
hx->inter_gb_ptr = NULL;
- if ((err = decode_slice_header(hx, h)) < 0)
+ if ((err = decode_slice_header(hx, h)) < 0) {
+ /* make sure data_partitioning is cleared if it was set
+ * before, so we don't try decoding a slice without a valid
+ * slice header later */
+ s->data_partitioning = 0;
break;
+ }
hx->s.data_partitioning = 1;
break;