[FFmpeg-cvslog] dcaenc: fix segfault when attempting to encode with invalid samplerate

Rostislav Pehlivanov git at videolan.org
Sat May 5 21:42:59 EEST 2018


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Sat May  5 18:42:53 2018 +0100| [c1b282dc74d801f943db282e89f7729e90897669] | committer: Rostislav Pehlivanov

dcaenc: fix segfault when attempting to encode with invalid samplerate

Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c1b282dc74d801f943db282e89f7729e90897669
---

 libavcodec/dcaenc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 186997c631..4b4ceeff05 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -152,8 +152,11 @@ static int subband_bufer_alloc(DCAEncContext *c)
 
 static void subband_bufer_free(DCAEncContext *c)
 {
-    int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS;
-    av_freep(&bufer);
+    if (c->subband[0][0]) {
+        int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS;
+        av_free(bufer);
+        c->subband[0][0] = NULL;
+    }
 }
 
 static int encode_init(AVCodecContext *avctx)



More information about the ffmpeg-cvslog mailing list