From patchwork Tue Apr 18 08:59:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 3440 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp1612295vsd; Tue, 18 Apr 2017 01:59:48 -0700 (PDT) X-Received: by 10.28.27.72 with SMTP id b69mr11848993wmb.34.1492505988525; Tue, 18 Apr 2017 01:59:48 -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 l82si15070398wmf.141.2017.04.18.01.59.47; Tue, 18 Apr 2017 01:59:48 -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 A7ED66891DF; Tue, 18 Apr 2017 11:59:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-2.mx.upcmail.net (vie01a-dmta-pe03-2.mx.upcmail.net [62.179.121.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CCE7068077A for ; Tue, 18 Apr 2017 11:59:29 +0300 (EEST) Received: from [172.31.216.44] (helo=vie01a-pemc-psmtp-pe02) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1d0Oz2-0003Cc-VJ for ffmpeg-devel@ffmpeg.org; Tue, 18 Apr 2017 10:59:36 +0200 Received: from [192.168.1.3] ([80.110.83.199]) by vie01a-pemc-psmtp-pe02 with SMTP @ mailcloud.upcmail.net id 9kzX1v01i4J261s01kzYYA; Tue, 18 Apr 2017 10:59:32 +0200 X-SourceIP: 80.110.83.199 From: Carl Eugen Hoyos To: FFmpeg development discussions and patches Date: Tue, 18 Apr 2017 10:59:31 +0200 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Message-Id: <201704181059.31700.cehoyos@ag.or.at> Subject: [FFmpeg-devel] [PATCH]lavf/mov: Only copy extradata if it exists. 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" Hi! Attached patch fixes an ubsan warning like the following here: libavformat/mov.c:2332:13: runtime error: null pointer passed as argument 2, which is declared to never be null Please comment, Carl Eugen From b117fdd2adf3271fcaf8f9388866aaf115284f74 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 18 Apr 2017 10:56:31 +0200 Subject: [PATCH] lavf/mov: Only copy extradata if it exists. Avoids undefined call of memcpy(ptr, NULL, 0); --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 2995a00..03fd90e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2321,7 +2321,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) } else if (a.size > 0) avio_skip(pb, a.size); - if (sc->extradata) { + if (sc->extradata && st->codecpar->extradata) { int extra_size = st->codecpar->extradata_size; /* Move the current stream extradata to the stream context one. */