From patchwork Fri Aug 16 23:15:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51047 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b6ca:0:b0:48e:c0f8:d0de with SMTP id s10csp736244vqj; Fri, 16 Aug 2024 16:26:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7/lYpx/oi5kRGn7ImscMfEOZnVaSiyz/nX6NUD5q3vqfxsmu9CKX2M6qaiaiRq0sJVuAIf1lQEZXYMyEdsNMNG1J5nK6Co2K/Ag== X-Google-Smtp-Source: AGHT+IE1XGtmAx7iKYDY3RXkMUbNjmAnRl8S/xmQD3Kp/atCat6ExFZhbd3b4djGagfrt4vWLSw0 X-Received: by 2002:a17:907:3f1a:b0:a7a:9d1e:3b28 with SMTP id a640c23a62f3a-a8392a38e58mr179272866b.5.1723850775087; Fri, 16 Aug 2024 16:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723850775; cv=none; d=google.com; s=arc-20160816; b=Tce+JvjmPo4etmlyAXciggavvv2vhxhoWkfFoPgBybwFhJAKaGjFktQ+toFbL5v7pn 5fBQJPt8XIVQW09KDg9WzL1wOHygs13BpRixh8mCGemOKAbXpN6ZRwXm1Vr8achkxcpn 5x4XT98sC0ZNlGxgF8yIgMn4mtvlMZXBVMK/JQLzpx28MLb2tRNkwo55/QGko5I4VBa4 i1sDjZs0HGetc0v5u4ck3F8tQ0WVOEr7KcEkDl/hP7ipvq8cdUJxuG+6YwxH14nDLaiV dNtoFCMCWhz2Lp59LLoLH8Z9/v/UNgtS0h01+6+/6xH6LAsuPW5STGzGu3GML+Sb42XB llNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=HIV5uvPKGWdGM8+9ebfqcX2+ljdd+wkZSpp8VbWH8WU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=j3ZBRgut9c4PRQevwQMxM4dm1mhD2RgLHFNWe6AcP+kVbFjdxWrCbS1qt1EgaBAWP/ mzht+HmIrQzLkgwf9nrjbRMfE24v40l4ugd5cBj9N+DSVZtL3SoTPuDEGunkXvf+3k9F lfk5+OVNhwBUFzPV2i4TCowX7YsPSr2GUhciyxjWqRityY2mMZQSpfGnZo8ytJGZXZc4 HfwPNz51P3kP1Ib4FsKQ5mm8cJPqZlst8f4j7WDeHk7hWe1o8jDsfQbPszq9afbsOXy2 ozOqVtDNTwENwXeuB89ayogky5s4af1QyZ7DPVxkwtuHGrkFiq7ajeWLBa/Wxxz6nSmw jUrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=EdycKXQ5; 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 a640c23a62f3a-a83838c872dsi250392666b.26.2024.08.16.16.26.14; Fri, 16 Aug 2024 16:26:15 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=EdycKXQ5; 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 A861B68DCCB; Sat, 17 Aug 2024 02:15:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A79C768DCC2 for ; Sat, 17 Aug 2024 02:15:08 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 44900FF802 for ; Fri, 16 Aug 2024 23:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1723850108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JT+UYfrmA5NlCIncEqmy6JOB04cSA0XbURzvDwPXF9g=; b=EdycKXQ582ByURSpg6rjp09gm+UC5IE1t+BdFULX+1hgWDz0Rrko1skPoQODm0nDhtj9AH srQWtPd1Ks6QpfRNViEnnOAVgo1XkPCPuH53KvWlC+YHkH8FgpAEfk0KMz8vtq88ULgJ9S mez5zEgBagDTznuGFyoB+r7OkYTS7onLkzTyGv9kwuIH/z3fQ9EuYArMOzJOJbPPwolLDQ OdG7DsALAN+zrgolG1CfQHSr6ONAM6bvGytAmz2QVkZOKiOoxrHr49CxHHRL9hsM7iH4Jq qE6lUERWLjSGZaRaS2bMP2LTlDPjNEjD5VPugQ/9BLKjss4JFcFFiUTuf9h/ww== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 17 Aug 2024 01:15:03 +0200 Message-ID: <20240816231504.3166080-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240816231504.3166080-1-michael@niedermayer.cc> References: <20240816231504.3166080-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/hevc/hevcdec: Check refPicList 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: pRHby2Pn5dZK This is likely not the proper way to fix this Fixes: null pointer dereference Fixes: 70781/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5010401476018176 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hevc/hevcdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 193d624fc98..dc8497bff12 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -1933,12 +1933,16 @@ static void hls_prediction_unit(HEVCLocalContext *lc, tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv; if (current_mv.pred_flag & PF_L0) { + if (!refPicList) + return; ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; if (!ref0 || !ref0->f) return; hevc_await_progress(s, ref0, ¤t_mv.mv[0], y0, nPbH); } if (current_mv.pred_flag & PF_L1) { + if (!refPicList) + return; ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; if (!ref1 || !ref1->f) return;