From patchwork Sat Apr 1 17:18:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3236 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp2536823vss; Sat, 1 Apr 2017 10:19:07 -0700 (PDT) X-Received: by 10.223.155.17 with SMTP id b17mr7640050wrc.181.1491067147390; Sat, 01 Apr 2017 10:19:07 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 126si8257262wmt.160.2017.04.01.10.19.07; Sat, 01 Apr 2017 10:19:07 -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 F0B25689AE8; Sat, 1 Apr 2017 20:18:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-1.mx.upcmail.net (vie01a-qmta-pe01-1.mx.upcmail.net [62.179.121.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 924E3689AD9 for ; Sat, 1 Apr 2017 20:18:50 +0300 (EEST) Received: from [172.31.218.34] (helo=vie01a-dmta-pe02-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1cuMfr-0005tr-5X for ffmpeg-devel@ffmpeg.org; Sat, 01 Apr 2017 19:18:51 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1cuMfl-0006jB-Rc for ffmpeg-devel@ffmpeg.org; Sat, 01 Apr 2017 19:18:45 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 35Jg1v01f0S5wYM015Jhr5; Sat, 01 Apr 2017 19:18:41 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 1 Apr 2017 19:18:36 +0200 Message-Id: <20170401171836.32701-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170401171836.32701-1-michael@niedermayer.cc> References: <20170401171836.32701-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/3] avformat/mov: Check creation_time for overflow 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" Fixes integer overflow Fixes: 701640 Found-by: Found-by: Thomas Guilbert Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index c9d076ee21..9c1c36c4be 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1186,6 +1186,12 @@ static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time) if (time) { if(time >= 2082844800) time -= 2082844800; /* seconds between 1904-01-01 and Epoch */ + + if ((int64_t)(time * 1000000ULL) / 1000000 != time) { + av_log(NULL, AV_LOG_DEBUG, "creation_time is not representable\n"); + return; + } + avpriv_dict_set_timestamp(metadata, "creation_time", time * 1000000); } }