1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +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

View File

@@ -537,8 +537,7 @@ static int get_last_needed_nal(H264Context *h)
{ {
int nals_needed = 0; int nals_needed = 0;
int first_slice = 0; int first_slice = 0;
int i; int i, ret;
int ret;
for (i = 0; i < h->pkt.nb_nals; i++) { for (i = 0; i < h->pkt.nb_nals; i++) {
H2645NAL *nal = &h->pkt.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_DPA:
case H264_NAL_IDR_SLICE: case H264_NAL_IDR_SLICE:
case H264_NAL_SLICE: case H264_NAL_SLICE:
ret = init_get_bits8(&gb, nal->data + 1, (nal->size - 1)); ret = init_get_bits8(&gb, nal->data + 1, nal->size - 1);
if (ret < 0) 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; return ret;
break;
}
if (!get_ue_golomb_long(&gb) || // first_mb_in_slice if (!get_ue_golomb_long(&gb) || // first_mb_in_slice
!first_slice || !first_slice ||
first_slice != nal->type) first_slice != nal->type)