From patchwork Sat Feb 3 21:45:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7500 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp1057865jai; Sat, 3 Feb 2018 13:45:43 -0800 (PST) X-Google-Smtp-Source: AH8x2258GPNerLhNUWFmP6UP2YhDkOR7R03kNA0OjjKrUu6irXiOe3m0uUWBCZ8o09s8XQ9swAPN X-Received: by 10.28.68.4 with SMTP id r4mr34187923wma.94.1517694343581; Sat, 03 Feb 2018 13:45:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517694343; cv=none; d=google.com; s=arc-20160816; b=MJk9V1me2ygoYVfejBzXlDVx/egrpU1rov8Oib0n9ntpBBJgH8z/HVak6gMsueQJke QWL1LFNnfmwwMBvOqwQmCT7vBk6fOQglNTBW+/UYgfXjwDZsDV0JYkUgxtfm3DUmu9SD 3vYMOhB5zLcbm30+Bk/Q7FURdlKCL6oNzJSgAYuDN5ITwlQ0IYWP3sTs451LEocEeHka tPbaB8QIRl/DTS9DSXwocq4E1u8C5/0gMUcoX/jydJIDQNImDX0DiBPYnsV1ObI8IjWW Cjc5yQu1eHnMjfZVheUw2lnrvZ+Qs6EjC3LHDal5dQe5E7syeYcWVP/SuVZ/up8MMmEV id1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=DqJu+b+Zl8ysaKuJXx/T6K0BqPdUiGXb7jIHAn2YJ+A=; b=a9wNxZB0nVDCfE0lwtUlAMObm1W3FmZ4SE4k9CnOiX0/iwkQS0I5J01Xy/4S5nkaiH NWH4TTA0mS1J8HgvbR2e6TxZrUDpT175ritJeJgNk2h9SbRIsIgeU2O6j1BY1zZ5MjqD +hvNWux3E86BZoVz+yYeeDVCpapWjeUJ/IGFDIcMTEeFIXQBjG0kQFTksLZvNfo6+ndN NI6dtPJeyDkw8oPE5jZQyLaqwrosUhsd+5+skRZpKQTB5Qa/OD0CLjfcHaBEgwz6QhBp BKl6hRE1sNGDI8fyjgMe43vEd6BzpfehmRPLzSCbj/EajZcpzBo+V9i63pAmeeNfA//D bbmg== 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 10si3442206wmj.62.2018.02.03.13.45.42; Sat, 03 Feb 2018 13:45:43 -0800 (PST) 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 572E5680489; Sat, 3 Feb 2018 23:45:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1D0C5680389 for ; Sat, 3 Feb 2018 23:45:28 +0200 (EET) Received: from [172.31.218.42] (helo=vie01a-dmta-pe04-3.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ei5cs-00028V-Kr for ffmpeg-devel@ffmpeg.org; Sat, 03 Feb 2018 22:45:34 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ei5cm-0000Uv-VL for ffmpeg-devel@ffmpeg.org; Sat, 03 Feb 2018 22:45:28 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 6MlQ1x01L0S5wYM01MlRV6; Sat, 03 Feb 2018 22:45:25 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 3 Feb 2018 22:45:24 +0100 Message-Id: <20180203214524.14908-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.1 Subject: [FFmpeg-devel] [PATCH] avformat/mov: Move +1 in check to avoid hypothetical overflow in add_ctts_entry() 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index d16b431e03..a9b9ec025f 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3233,7 +3233,7 @@ static int64_t add_ctts_entry(MOVStts** ctts_data, unsigned int* ctts_count, uns FFMAX(min_size_needed, 2 * (*allocated_size)) : min_size_needed; - if((unsigned)(*ctts_count) + 1 >= UINT_MAX / sizeof(MOVStts)) + if((unsigned)(*ctts_count) >= UINT_MAX / sizeof(MOVStts) - 1) return -1; ctts_buf_new = av_fast_realloc(*ctts_data, allocated_size, requested_size);