[FFmpeg-cvslog] avcodec/decode: Check max_samples in get_buffer_internal()

Michael Niedermayer git at videolan.org
Wed Sep 25 18:34:03 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Sep 25 16:18:32 2019 +0200| [121bf1b3b8de8de82856e42b8ed5156d4d78b637] | committer: Michael Niedermayer

avcodec/decode: Check max_samples in get_buffer_internal()

This checks max_samples at the same level as max_pixels

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/decode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index a9ea5a51e6..081847551e 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1924,6 +1924,11 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
             av_log(avctx, AV_LOG_ERROR, "pic->data[*]!=NULL in get_buffer_internal\n");
             return AVERROR(EINVAL);
         }
+    } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
+        if (frame->nb_samples > avctx->max_samples) {
+            av_log(avctx, AV_LOG_ERROR, "samples per frame %d, exceeds max_samples %"PRId64"\n", frame->nb_samples, avctx->max_samples);
+            return AVERROR(EINVAL);
+        }
     }
     ret = ff_decode_frame_props(avctx, frame);
     if (ret < 0)



More information about the ffmpeg-cvslog mailing list