diff mbox series

[FFmpeg-devel,1/2] avcodec/aacpsy: Check model_priv_data before dereferencing in psy_3gpp_end()

Message ID 20210319152652.19864-1-michael@niedermayer.cc
State Accepted
Commit 28859d6e7cdbf0cc230cbf782f3895a9fa22616c
Headers show
Series [FFmpeg-devel,1/2] avcodec/aacpsy: Check model_priv_data before dereferencing in psy_3gpp_end()
Related show

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 19, 2021, 3:26 p.m. UTC
Fixes: null pointer dereference
Fixes: av_freep.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/aacpsy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer March 25, 2021, 5:15 p.m. UTC | #1
On Fri, Mar 19, 2021 at 04:26:51PM +0100, Michael Niedermayer wrote:
> Fixes: null pointer dereference
> Fixes: av_freep.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/aacpsy.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index fca692cb15..482113d427 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -855,7 +855,8 @@  static void psy_3gpp_analyze(FFPsyContext *ctx, int channel,
 static av_cold void psy_3gpp_end(FFPsyContext *apc)
 {
     AacPsyContext *pctx = (AacPsyContext*) apc->model_priv_data;
-    av_freep(&pctx->ch);
+    if (pctx)
+        av_freep(&pctx->ch);
     av_freep(&apc->model_priv_data);
 }