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

Michael Niedermayer michael at niedermayer.cc
Fri Mar 19 17:26:51 EET 2021


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

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);
 }
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list