From patchwork Mon Nov 27 03:12:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 6387 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp1161701jah; Sun, 26 Nov 2017 19:13:10 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ7PhCIa8S43+sn5Wu0rfqgwpvFG/J2DtblTqwVI+aR4ibj8nYHsRJDvwjevVNSlSVyFaK+ X-Received: by 10.223.186.197 with SMTP id w5mr9402092wrg.201.1511752390426; Sun, 26 Nov 2017 19:13:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511752390; cv=none; d=google.com; s=arc-20160816; b=BA6nmaN4pozrDFf4b+CnqdUcrWjKbD43csmQPmW4+d6XAcPDT3JzLAzfGNGYTAPKUq L74gh6jvSUIu46A6xOuMKVSE8AkXbKjLxYVK7tSLJ+W+QcvQt3A6kW0CWtr3jVscT3y2 o95qcrOqHWYgrB4VSjNtBjOuvsrGx4QGjO4cOpF1oFDLkiQryjWzbHot2GVHN+y2oBEo HKBEP1nXtMJzhDExjKOOy5BvbWLzgrI6sCxpImRjuKeY0tMunGuc39HHBDq1v1FUKWNd CJqc5nK/2TXR2nWMLj6fsUcipExDahFccli81kCwqlESzUmm6auloMRRq6x+obZjgYIk lTUQ== 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:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=orFD5aOBYpnL1ZHXigek4C9xadG7HngY8+WkwZ7uwYQ=; b=1G0IGGy5hpao11+DV2dsvSevxcgaKI4MrFBGC2aU/Drnk8Ol2BWszzoZPCIrwA8/Uq wn5I1w6cYp40bGDea3tsNDFzzHaonvQd4xNsmtwUfPL/Hx4tPp2CI7yWFFQAUqw+M71J Lr14jX/6WB6HkNzPJSzJOhZ9ZLX04bFRZ37SnYATE5K2YsocYFfmjlYJpXNiyXK3Y47e /qKHyKC9kkSwczAIZd0IbjdPg3HSsYLf30N2OAl+BvFlGXiX9/00SNwsff2S7wT1VCeW I1h42G820OqXGQZGtyugZYxIgKJESUOOhTco3jAzHjsDeQvEtiX1Z+7oKtj7+b6RJRTM s/7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@163.com header.s=s110527 header.b=O3Y+tzPq; 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 k48si19512900wrc.358.2017.11.26.19.13.10; Sun, 26 Nov 2017 19:13:10 -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; dkim=neutral (body hash did not verify) header.i=@163.com header.s=s110527 header.b=O3Y+tzPq; 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 73FE1689FD9; Mon, 27 Nov 2017 05:13:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from m12-15.163.com (m12-15.163.com [220.181.12.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 13EA3689D60 for ; Mon, 27 Nov 2017 05:12:59 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=mF9R7gw28NxK+qdxPb LrE1Tq+SQOJ13zHv2MJPU5JgI=; b=O3Y+tzPqg+Sxl/RguiuPvohVfbLIH9a/tL cLRssSx7+bv29qo1TsBEhwGE1ZNy3Qs6/5WZdcP4Xj/rEBUwh5yAeZWzjs20SpIK QZeTjR0TZ7iSncgm0tWKakXIIdzpj4veRBsRu2Ii6ULb93nn3Xp3tOJua/XnAIP5 fwD5uEp9s= Received: from localhost.localdomain (unknown [106.120.213.112]) by smtp11 (Coremail) with SMTP id D8CowAAXhtK5ghtaYSzABQ--.22352S3; Mon, 27 Nov 2017 11:12:59 +0800 (CST) From: Pan Bian To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Nov 2017 11:12:56 +0800 Message-Id: <1511752376-25246-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: D8CowAAXhtK5ghtaYSzABQ--.22352S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF45Jr1fGr15CrWxCr1xKrg_yoWxuFb_t3 WxXrn2q3yj9F13Jw4Y9ay5Gr40yr48CrWS93WrtFsayas3Xr1UA34vqwn5u3s5urWSyrWU G397ArnxJw1I9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU89jj3UUUUU== X-Originating-IP: [106.120.213.112] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiQBudclSIUEtXTgAAsq Subject: [FFmpeg-devel] [FFmpeg-devel 1/2] avformat/mov: set correct error code in mov_read_custom 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 Cc: Pan Bian MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" In function mov_read_custom(), it returns 0 on the path that av_malloc() returns a NULL pointer. 0 indicates success. An error code should be assigned to ret. Signed-off-by: Pan Bian --- libavformat/mov.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index ddb1e59..d25071b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4177,8 +4177,10 @@ static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom) break; *p = av_malloc(len + 1); - if (!*p) + if (!*p) { + ret = AVERROR(ENOMEM); break; + } ret = ffio_read_size(pb, *p, len); if (ret < 0) { av_freep(p);