From patchwork Sun Sep 22 21:56:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51712 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d154:0:b0:48e:c0f8:d0de with SMTP id bt20csp2138763vqb; Sun, 22 Sep 2024 15:09:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUcI5F2WyXDpGODWIp6zTr7/8NHraTti+KTpokoxbJ8evWvvPtLN/7gQC9Cr4WKPIzPzA3Gk0jyCbt5uipdcx0f@gmail.com X-Google-Smtp-Source: AGHT+IE9buDd3IqNSzDOPxw4j+GV0mHJk2gKBfS7eujuF2L9s33JaUAvZ+99M9dga9goh9Tb1Oef X-Received: by 2002:a05:6402:34d1:b0:5c3:c548:ab3a with SMTP id 4fb4d7f45d1cf-5c4646640bfmr8235456a12.2.1727042959472; Sun, 22 Sep 2024 15:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727042959; cv=none; d=google.com; s=arc-20240605; b=lgOBQYACDyM66T67R1RjW2uaLDOVA/AO9ETo975nau3M/JxoPEbCPSS5X//ayIibXt VLMylrMLRm6rWaVcjP/umjSVeS8oZBzCLQFBM17nk1J9KxWqFLp5qlTdepBgGarVb5nC Zt+ON3+Rk8MofPw9bzY7TgqvqvB4ttGEgRw9KJTDSJ5o4j3jHO1gHX/jLenmXZbStoPP 2dhxGJ+mK6qoGL8LNZoHbYCMj1JxzKNgFucoOQS05kR87UlUrnyfcVVt0M8G5aYhaouX BDo1Dv5YDXio6Du/efgRZF2gx/siN+k+bNTmVOc9teRKdlA41mPCrAJ3UxaMTRh2xgde +GSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=28NxTybF0o6osvbuNXLFY+Gh8N9DjsIEDXf+Yy0eUpM=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=lLh40p6g3+xgYRKv2aWqo3Nf170LWf5j4oRYsRVH0LFqi5N9sdaCa3z4EW4FPHZOID kLRWXW5bzyvhJ/CIJoxgzzasHW3E029Ayq5FoQFKqIelf9IkFWgKBsxmziXEzqgF0c7Z 4M8aJosrd6kyyb/QyNl8xzNfc8W0QTZn8AdJzT7M9jnTGe/2STVN4eDeUISqOljv26Mu yjLKrpOrz6K1j9q9tBXg4i9/xuIXEaQgm/pSfWn3CFu5GuVnF/kzGnsOiWpU3CMajgv/ kMIU7LVW52Bw+4wMC6DL9EHW9Dx6MHYHi13YSFJJZGnoTa9p0rV7EDD2ztbF9yD4Qiuq iw+g==; 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=lVZE0vRK; 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 4fb4d7f45d1cf-5c42bb5b3edsi13158686a12.152.2024.09.22.15.09.18; Sun, 22 Sep 2024 15:09:19 -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=lVZE0vRK; 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 4588368DBE6; Mon, 23 Sep 2024 00:57:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7A34F68DB92 for ; Mon, 23 Sep 2024 00:56:54 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E0254E0002 for ; Sun, 22 Sep 2024 21:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1727042214; 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=2f9LNLAXjsW0JdkS2oNzjM8OuHmvTCSk5kb4v5DYvog=; b=lVZE0vRK2T8R5Vltpo/s8Tzkqkp/vyTybR2ZWlbCmFGxgFg6ABtkck8BB5XHKsIIRYGf9D TMTnsoiyKfznwvi7+nQhCbTkqFY3frHq6DAhD4uOrRhUbQo7LtgcjK4MAFCYB2lkKjmYNT Uo2dcVdfe8Otcn4T9h1Nm1fYD4YY56Z5eht1pUYUtA0/LollspeMPbKaDQBCiNQrdaBwPQ 5jxd4qXvCSuzqWBtab5uvBY7KRvDNEXxKJS/Gy/qzRudUzXtRHOL3Fmzkg/hUg1jL+LF3P Eo0keByRbrm9l/ZkQByZppUkgyixMwbPRO0M4Pl+Z7yaqky0lpAsIfM4m4iP5Q== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 22 Sep 2024 23:56:44 +0200 Message-ID: <20240922215645.1182935-9-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240922215645.1182935-1-michael@niedermayer.cc> References: <20240922215645.1182935-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 09/10] avcodec/vble: Allocate buffer later 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: 1SCAvzYKOeTc Fixes: Timeout Fixes: 71727/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VBLE_fuzzer-6126342574243840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/vble.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/vble.c b/libavcodec/vble.c index 4511433a6c9..c48feb9a591 100644 --- a/libavcodec/vble.c +++ b/libavcodec/vble.c @@ -130,10 +130,6 @@ static int vble_decode_frame(AVCodecContext *avctx, AVFrame *pic, return AVERROR_INVALIDDATA; } - /* Allocate buffer */ - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) - return ret; - /* Version should always be 1 */ version = AV_RL32(src); @@ -148,6 +144,10 @@ static int vble_decode_frame(AVCodecContext *avctx, AVFrame *pic, return AVERROR_INVALIDDATA; } + /* Allocate buffer */ + if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + return ret; + /* Restore planes. Should be almost identical to Huffyuv's. */ vble_restore_plane(ctx, pic, &gb, 0, offset, avctx->width, avctx->height);