[FFmpeg-devel] [PATCH] avcodec/h264_slice: Remove dead sps check

Rémi Denis-Courmont remi at remlab.net
Mon May 13 09:04:34 EEST 2024



Le 6 mai 2024 04:23:07 GMT+03:00, Michael Niedermayer <michael at niedermayer.cc> a écrit :
>Fixes: CID1439574 Dereference after null check

If SPS is guaranteed to be non-NULL, there should probably be an assertion to document it, and it should be *before* that alleged dereference (which is not visible in the patch context).

>
>Sponsored-by: Sovereign Tech Fund
>Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
>---
> libavcodec/h264_slice.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
>index 90d37f60848..ce2c4caca1b 100644
>--- a/libavcodec/h264_slice.c
>+++ b/libavcodec/h264_slice.c
>@@ -1396,7 +1396,7 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
> 
>     sps = h->ps.sps;
> 
>-    if (sps && sps->bitstream_restriction_flag &&
>+    if (sps->bitstream_restriction_flag &&
>         h->avctx->has_b_frames < sps->num_reorder_frames) {
>         h->avctx->has_b_frames = sps->num_reorder_frames;
>     }


More information about the ffmpeg-devel mailing list