diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-03-20 17:02:36 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-09 13:53:29 +0200 |
commit | 322a0a6dd2a2a5f3df10b8b2453ee0494d03741a (patch) | |
tree | 07d0ec5238614ee15ff8514b052c020128981fea | |
parent | 61f87c7207b5d468b540526baa483bb3ee91f00f (diff) | |
download | ffmpeg-322a0a6dd2a2a5f3df10b8b2453ee0494d03741a.tar.gz |
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 80472438996ed1928b30f6ac4e0d17a492de2cdf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/h264_slice.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 272f3b00a4..3037ce1c69 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -920,6 +920,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); |