aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-19 00:19:52 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-19 00:19:52 +0200
commit641dccc2aa5e0bf6b3c06998f9a7f24a5cf725e7 (patch)
tree26f34344cb0992c82f946dfdf91140bb3525ac73
parent4a81bddb4d9bd6402fc3be64ca406dda7976058d (diff)
downloadffmpeg-641dccc2aa5e0bf6b3c06998f9a7f24a5cf725e7.tar.gz
avcodec/h264: Check init_get_bits8() for failure
Fixes CID1361935 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/h264.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index eb4ad78a0e..b870a72d38 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1007,6 +1007,7 @@ static int get_last_needed_nal(H264Context *h)
int nals_needed = 0;
int first_slice = 0;
int i;
+ int ret;
for (i = 0; i < h->pkt.nb_nals; i++) {
H2645NAL *nal = &h->pkt.nals[i];
@@ -1024,7 +1025,9 @@ static int get_last_needed_nal(H264Context *h)
case NAL_DPA:
case NAL_IDR_SLICE:
case NAL_SLICE:
- init_get_bits8(&gb, nal->data + 1, (nal->size - 1));
+ ret = init_get_bits8(&gb, nal->data + 1, (nal->size - 1));
+ if (ret < 0)
+ return ret;
if (!get_ue_golomb_long(&gb) || // first_mb_in_slice
!first_slice ||
first_slice != nal->type)
@@ -1076,6 +1079,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
if (avctx->active_thread_type & FF_THREAD_FRAME)
nals_needed = get_last_needed_nal(h);
+ if (nals_needed < 0)
+ return nals_needed;
for (i = 0; i < h->pkt.nb_nals; i++) {
H2645NAL *nal = &h->pkt.nals[i];