1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-20 11:14:12 +02:00

Merge commit '76f7e70aa04fc5dbef5242b11cbf8fe4499f61d4'

* commit '76f7e70aa04fc5dbef5242b11cbf8fe4499f61d4':
  h264dec: handle zero-sized NAL units in get_last_needed_nal()

See 641dccc2aa

Merged-by: Clément Bœsch <cboesch@gopro.com>
This commit is contained in:
Clément Bœsch 2017-01-31 17:17:21 +01:00
commit 4039076dc3

View File

@ -537,8 +537,7 @@ static int get_last_needed_nal(H264Context *h)
{
int nals_needed = 0;
int first_slice = 0;
int i;
int ret;
int i, ret;
for (i = 0; i < h->pkt.nb_nals; i++) {
H2645NAL *nal = &h->pkt.nals[i];
@ -556,9 +555,14 @@ static int get_last_needed_nal(H264Context *h)
case H264_NAL_DPA:
case H264_NAL_IDR_SLICE:
case H264_NAL_SLICE:
ret = init_get_bits8(&gb, nal->data + 1, (nal->size - 1));
if (ret < 0)
return ret;
ret = init_get_bits8(&gb, nal->data + 1, nal->size - 1);
if (ret < 0) {
av_log(h->avctx, AV_LOG_ERROR, "Invalid zero-sized VCL NAL unit\n");
if (h->avctx->err_recognition & AV_EF_EXPLODE)
return ret;
break;
}
if (!get_ue_golomb_long(&gb) || // first_mb_in_slice
!first_slice ||
first_slice != nal->type)