From patchwork Wed Sep 26 22:00:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 10497 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:1286:0:0:0:0:0 with SMTP id 6-v6csp1234358jap; Wed, 26 Sep 2018 15:01:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Rcs/KmbCKxQCfqOL8VttSQOMLSNEGUgUPQsmoj6kHjVET1YuCRNESwbxu5DJ+sqSPgM3V X-Received: by 2002:a1c:80d4:: with SMTP id b203-v6mr6072855wmd.100.1537999311830; Wed, 26 Sep 2018 15:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537999311; cv=none; d=google.com; s=arc-20160816; b=otg8hhu0yP10XmxTV5dYzYCMbRsxQsa97ERfSF/B0L5xCtqdlRVPrXvPK6V9gLoUu4 gkYQo1obpHLPfuqW9CrMly00EqpNgaIID8P23iJujDA30SH7/koNabyHZ1Ta1almJK3d v7Q35rFhz6D/Gudv2B4rwBmg9acfRFs8xDzd0D/h9vEe85qR0Gg/7J8XR1Rv9LNV9AOW juDhuN8I76R+5z9cCBcfw6FsS1Iz4FIwpVo/CQQ8Qrz2htthSskE0iEpFxPrVj6PLke5 r+fXH/8Rf2V2NGgywoHjisMjXcAkYOe2hWlkT2b1Y/e7JXV8FdYcm3epuiRQ1HippJCH vgnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=2SI8p/bhTWiXPrl5yX73nTjsm0+WAqbBP0+GVFXpQ40=; b=0t8xknY8cDEE8Ws41SvTD+uvwH9WB1CPi/mMCkfod8175/p2yW/WQ75TYCS9dPq3GY 9LAn+R6GdtwFmqcUFnY9KcDeh+tII7qPBFX05y+8jnaXDnFWe5jtNU9lVaYBV4RMw0dd 9XneOLwnNptSLnsLbZXVcXLZddF6SlPMeRxFuJwar/Zr9wmvNvyHJtnNhllYER+o3i5x V8g8WEeKPDSVrrBEp3AgkTrWbRn5YjGoMi/7/hnHkZYOMO2mbOmw587fRmqIUXNVkJAn +1Lc0+0/eiDtLWavCn9IQtALk3dFR6eTqw6hNaAYxv1VslotqvLoah+XWyapZbiL1JY6 u76w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 5-v6si171585wre.304.2018.09.26.15.01.51; Wed, 26 Sep 2018 15:01:51 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E7C7268A580; Thu, 27 Sep 2018 01:01:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-3.mx.upcmail.net (vie01a-qmta-pe02-3.mx.upcmail.net [62.179.121.183]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 25889689EBA for ; Thu, 27 Sep 2018 01:01:14 +0300 (EEST) Received: from [172.31.218.54] (helo=vie01a-dmta-pe08-3.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1g5HsA-0007bg-Om for ffmpeg-devel@ffmpeg.org; Thu, 27 Sep 2018 00:01:30 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1g5Hs5-0007Ox-80 for ffmpeg-devel@ffmpeg.org; Thu, 27 Sep 2018 00:01:25 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id gN1L1y00F0S5wYM01N1M8Z; Thu, 27 Sep 2018 00:01:21 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 27 Sep 2018 00:00:26 +0200 Message-Id: <20180926220026.29751-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180926220026.29751-1-michael@niedermayer.cc> References: <20180926220026.29751-1-michael@niedermayer.cc> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avformat/utils: Fix potential integer overflow in extract_extradata() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index c1835b1ab5..3e99478ad9 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) { - avsti->avctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); + av_assert0(!avsti->avctx->extradata); + if ((unsigned)extradata_size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) + avsti->avctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avsti->avctx->extradata) { av_packet_unref(pkt_ref); return AVERROR(ENOMEM);