[FFmpeg-cvslog] avformat/utils: Fix potential integer overflow in extract_extradata()
Michael Niedermayer
git at videolan.org
Sun Oct 7 04:07:54 EEST 2018
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Sep 27 00:00:26 2018 +0200| [0a41a8bf2945e59db7a0773ebce11a26b95d45b6] | committer: Michael Niedermayer
avformat/utils: Fix potential integer overflow in extract_extradata()
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a41a8bf2945e59db7a0773ebce11a26b95d45b6
---
libavformat/utils.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index dcc0de9255..a8ac90213e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3544,7 +3544,9 @@ static int extract_extradata(AVStream *st, AVPacket *pkt)
&extradata_size);
if (extradata) {
- sti->avctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ av_assert0(!sti->avctx->extradata);
+ if ((unsigned)extradata_size < FF_MAX_EXTRADATA_SIZE)
+ sti->avctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!sti->avctx->extradata) {
av_packet_unref(pkt_ref);
return AVERROR(ENOMEM);
More information about the ffmpeg-cvslog
mailing list