summaryrefslogtreecommitdiff
path: root/libavcodec/h264_slice.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-20 17:02:36 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-06 14:41:41 +0200
commit6537a9300860d1fe25f25b5b308b6f0093a65387 (patch)
tree05b4b4186153a39dfb6cdedfaf25b6536c799a42 /libavcodec/h264_slice.c
parent3ac8105084fc0580ec536a22b4a5907b61d2c3b0 (diff)
downloadffmpeg-6537a9300860d1fe25f25b5b308b6f0093a65387.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>
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r--libavcodec/h264_slice.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index b0c890a251..400a406440 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -912,6 +912,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);