Commit 4039076d authored by Clément Bœsch's avatar Clément Bœsch

Merge commit '76f7e70a'

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

See 641dccc2Merged-by: 's avatarClément Bœsch <cboesch@gopro.com>
parents 5f633c39 76f7e70a
...@@ -537,8 +537,7 @@ static int get_last_needed_nal(H264Context *h) ...@@ -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) ...@@ -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) {
return ret; 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 if (!get_ue_golomb_long(&gb) || // first_mb_in_slice
!first_slice || !first_slice ||
first_slice != nal->type) first_slice != nal->type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment