diff mbox series

[FFmpeg-devel,2/6] avcodec/h264_slice: Check sps in h264_slice_header_init()

Message ID 20210322205833.14541-2-michael@niedermayer.cc
State Accepted
Commit 80472438996ed1928b30f6ac4e0d17a492de2cdf
Headers show
Series [FFmpeg-devel,1/6] avcodec/h264_slice: Check input SPS in ff_h264_update_thread_context() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer March 22, 2021, 8:58 p.m. UTC
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>
---
 libavcodec/h264_slice.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Michael Niedermayer March 25, 2021, 5:18 p.m. UTC | #1
On Mon, Mar 22, 2021 at 09:58:29PM +0100, Michael Niedermayer wrote:
> 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>
> ---
>  libavcodec/h264_slice.c | 5 +++++
>  1 file changed, 5 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 910d8b8848..62f7a61aed 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -921,6 +921,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);