diff mbox series

[FFmpeg-devel] swscale/slice: Check slice for allocation failure

Message ID 20210708104026.23123-1-michael@niedermayer.cc
State Accepted
Commit 997f9cfc1295769be8d3180860ceebbc16f59069
Headers show
Series [FFmpeg-devel] swscale/slice: Check slice for allocation failure | 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 July 8, 2021, 10:40 a.m. UTC
Fixes: null pointer dereference
Fixes: alloc_slice.mp4

Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libswscale/slice.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer July 9, 2021, 12:58 p.m. UTC | #1
On Thu, Jul 08, 2021 at 12:40:26PM +0200, Michael Niedermayer wrote:
> Fixes: null pointer dereference
> Fixes: alloc_slice.mp4
> 
> Found-by: Rafael Dutra <rafael.dutra@cispa.de>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libswscale/slice.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply


[...]
diff mbox series

Patch

diff --git a/libswscale/slice.c b/libswscale/slice.c
index d96db13364..68517da00b 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -288,7 +288,8 @@  int ff_init_filters(SwsContext * c)
     if (!c->desc)
         return AVERROR(ENOMEM);
     c->slice = av_mallocz_array(sizeof(SwsSlice), c->numSlice);
-
+    if (!c->slice)
+        goto cleanup;
 
     res = alloc_slice(&c->slice[0], c->srcFormat, c->srcH, c->chrSrcH, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
     if (res < 0) goto cleanup;