From patchwork Thu May 25 21:40:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 41830 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c51c:b0:10c:5e6f:955f with SMTP id gm28csp865383pzb; Thu, 25 May 2023 14:41:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4g23ckWLhTRVIL0oCJpzOjPgxg9oZu1TvbnOraYEQ6Xn63iZEGjNGfCs8Nb5FXN2gIXKsJ X-Received: by 2002:a17:907:9413:b0:967:5c5f:e45c with SMTP id dk19-20020a170907941300b009675c5fe45cmr188917ejc.0.1685050866986; Thu, 25 May 2023 14:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050866; cv=none; d=google.com; s=arc-20160816; b=XaapjPlyczSEglQJjTyG5rxdiu4gOX35y24vhSsbw2NVhl9S28A52idVhtKZwa3vdZ kNXgg/C6N4cyeFLwzCPaP8gxSsKECBo4fgMyhI6cl7mvKTg/0C0drfMStP54yAIDRo6J 41yAtpGbGkqcYu8aSAKEHL8p1sEe9QGdYOfDfaBlG3ILJBgLSet7RUfiebhd0BAmJKQh eRXGPY5ZZFPZ8TFw8AJ/EnMOJn9dS+Hp4OnTZlE25LG++Hym6gXAC3GkUL0mfT2T8Oii 1SPbyIm1u9ppsPQGSAPX5jUR7ZnJ8GPSotVQWjrckSvvJcWQvU1fzkb/D5Kmhg5qJiJT keDg== 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:references:in-reply-to:message-id:date :to:from:delivered-to; bh=sIb3TFz/DTqDzQP06vgBbEarL2qhlB8ME6V4EuvfTac=; b=W90IfWYc3V5bt7byoECJQsDN4twRO5YiUOJCTGz/BpTtAwyTtVgweSmQPAdDC/XMnt wbYZwHaagWj+MEs5N45fjxkSvdKOPvGvbNHHw+LxbskJJ9lSCPV0p9VYIP/yUqhAAI8n ozkauWNCinvkKadOncU6Ppf5QxKz7HYiUjPhGjTY61c9edLx8jKdAFjBeXtFWuLbeijt oxyGPW1E0LbFD3JAw3FB48qFsUoUJM1gllgt0Y91blR+BJKxzUdN/rAQiWDvfhAKoUbo 4O2xZLJ9fKuPogjBlGRPm/ecvgRACeWsBtPwrmKEGnzOtM8cjzr+Lkfy2Qp5oF4BTXLR zuxQ== 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 kg7-20020a17090776e700b0094f07a86d4fsi1580361ejc.126.2023.05.25.14.41.06; Thu, 25 May 2023 14:41:06 -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 A88FF68C1B1; Fri, 26 May 2023 00:40:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 779D268C13F for ; Fri, 26 May 2023 00:40:24 +0300 (EEST) X-GND-Sasl: michael@niedermayer.cc Received: by mail.gandi.net (Postfix) with ESMTPSA id AE7CC240002 for ; Thu, 25 May 2023 21:40:23 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 25 May 2023 23:40:18 +0200 Message-Id: <20230525214019.29048-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230525214019.29048-1-michael@niedermayer.cc> References: <20230525214019.29048-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/hevcdec: Avoid null pointer dereferences in MC X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: oijgxWl8pkUK Fixes: runtime error: pointer index expression with base 0x000000000000 overflowed to 0xfffffffffffffff8 Fixes: 58440/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5956015530311680 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hevcdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 7e1bf4e915..90000203e4 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -1940,13 +1940,13 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0, if (current_mv.pred_flag & PF_L0) { ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; - if (!ref0) + if (!ref0 || !ref0->frame->data[0]) return; hevc_await_progress(s, ref0, ¤t_mv.mv[0], y0, nPbH); } if (current_mv.pred_flag & PF_L1) { ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; - if (!ref1) + if (!ref1 || !ref1->frame->data[0]) return; hevc_await_progress(s, ref1, ¤t_mv.mv[1], y0, nPbH); }