[FFmpeg-cvslog] avcodec/wmaenc: Check operations that can fail

Andreas Rheinhardt git at videolan.org
Wed May 12 07:47:53 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu May  6 17:55:12 2021 +0200| [20232cbbf7cd9f6e2f139db8d3d9c7040a1e5002] | committer: Andreas Rheinhardt

avcodec/wmaenc: Check operations that can fail

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

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

diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 2a78325298..3035668487 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -88,8 +88,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
         return ret;
 
     /* init MDCT */
-    for (i = 0; i < s->nb_block_sizes; i++)
-        ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);
+    for (i = 0; i < s->nb_block_sizes; i++) {
+        ret = ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);
+        if (ret < 0)
+            return ret;
+    }
 
     block_align        = avctx->bit_rate * (int64_t) s->frame_len /
                          (avctx->sample_rate * 8);



More information about the ffmpeg-cvslog mailing list