Browse Source

avcodec/h264_slice: Check sps in h264_slice_header_init()

Fixes: null pointer dereference
Fixes: h264_slice_header_init.mp4

Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Tested-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8047243899)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.4
Michael Niedermayer 4 years ago
parent
commit
039ecef275
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavcodec/h264_slice.c

+ 5
- 0
libavcodec/h264_slice.c View File

@@ -922,6 +922,11 @@ static int h264_slice_header_init(H264Context *h)
const SPS *sps = h->ps.sps;
int i, ret;

if (!sps) {
ret = AVERROR_INVALIDDATA;
goto fail;
}

ff_set_sar(h->avctx, sps->sar);
av_pix_fmt_get_chroma_sub_sample(h->avctx->pix_fmt,
&h->chroma_x_shift, &h->chroma_y_shift);


Loading…
Cancel
Save