[FFmpeg-cvslog] avcodec/h264_slice: Check sps in h264_slice_header_init()

Michael Niedermayer git at videolan.org
Thu Apr 1 12:49:30 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sat Mar 20 17:02:36 2021 +0100| [039ecef275dae2fd459155be9700b98a8c69f932] | committer: Michael Niedermayer

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 at cispa.de>
Tested-by: Rafael Dutra <rafael.dutra at cispa.de>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 80472438996ed1928b30f6ac4e0d17a492de2cdf)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=039ecef275dae2fd459155be9700b98a8c69f932
---

 libavcodec/h264_slice.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 14b945756b..84b5710ab4 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -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);



More information about the ffmpeg-cvslog mailing list