From patchwork Sun Sep 22 21:56:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51711 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d154:0:b0:48e:c0f8:d0de with SMTP id bt20csp2138757vqb; Sun, 22 Sep 2024 15:09:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXWCOy+Jbv5EkB/Hz14Sji3mULcGbusHyoshH1S56pFnEWTOTdhhZZkraVQC+Pq0/6ptoF8rZoWifNiC/R4iPZ0@gmail.com X-Google-Smtp-Source: AGHT+IHmrY4S22lWNw2FcrEQ74Uh4Jpyc5+Mpetz8PMrK8Oad3nP1TqLUeuirSIPP117wdb/jrLP X-Received: by 2002:a05:6512:308c:b0:536:9efb:bb29 with SMTP id 2adb3069b0e04-536ac32e3camr4390919e87.44.1727042958670; Sun, 22 Sep 2024 15:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727042958; cv=none; d=google.com; s=arc-20240605; b=Li4V9mKfQHj4UVPspXTuLxF7wzatTyA1BLqi83J+8Euj2uj6uRjW33MANaD4as6ATj AgVxgmnZnkkkhsqDohVDJwkSxsMSicUjAnZLmv9gbXko9XIm90S7lkSyNo6fspiMt9DO cNzkxfaXtASaI3xIWw0oaVDiuQ52ye6j2s9CnI2FsYQEiIciU/wzJ9W7ldXMadv/F86M +xKjDtPyqTX0c3TvFh6sIio9hl3lUczP4qOQ3NoUozYCyuWBz4r7EiLwLK4o/C9nawKW x1/dA0NWfVAVz6v7xMTE8Wcc5is3Rfy8eEI4pJtc7N/xrZMLQNQTnHXhgDjlNvGiT336 JKnw== 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=Da+mOg79HRm8aAG6nI32i3dCvVlt3qzJ6QvrqXYjVNg=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=R4IDg/uCAz6f1ZIw2b+zp5NjwF+sTxTh9G9F6TY7IGQJM93y0LHaMrneO9sxOrs747 ICKb61im14dsAKzipY5sDDvHp7MqpCdf2Ognd8LLL38Oc0xBHWN0ND9ykHl2u3H0d+vL WCmjMvV7FFjrpvGgKKFlqS9BlJs/1bWnFLXLwirQMxJ2QPTDIT9U5FMthmBCx1pW2R31 C2XyCWBkV4i4uVt34YVGYp3PYWb3zgqWH/AjGUl1tvcibMD8eul+Ccfogs5nexzOImBa vSGkUsKJ6+O1iCNNew95E4PJaIIpt0sut0ct2vgWlxfkmnd7zX0/4Y/LhVAECSROiqGB UXbQ==; 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=ON5Cl0uJ; 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 2adb3069b0e04-53687042dddsi6915080e87.49.2024.09.22.15.09.18; Sun, 22 Sep 2024 15:09:18 -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=ON5Cl0uJ; 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 6A1DC68DAE4; Mon, 23 Sep 2024 00:57:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3693568DAF3 for ; Mon, 23 Sep 2024 00:56:55 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 94964C0003 for ; Sun, 22 Sep 2024 21:56:54 +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=qnXZeAsLxt+q0ncPZOCh7x9Yyxe0njCfcSNcXIj9Kyo=; b=ON5Cl0uJPUHteKiBZSHtROxLrQGLP4o6QFZySLaghpciRB539ecZW8ykdo44H1PSNFdYUK Xznp8pwzNPz0hd6Wrhr5oa5L2JGjjS+Sp6nvVLlvqPfcGudVHBj6rOs4+VJUwBRHO5CMy6 hXgwa/32a1XzkpmOOaJUIm/92nOUaqnDnzg6lt1i7qadB13BFmt6uSixzLvMkQVGAmjY6i wfQyrXGS336qoCQfykj/CpenpmMkh7ZbnsOebyyeD6gIx8t6DyLD23Qs65bEiEGLmyK32F KDTkp/a56P28Tf9q32AaIr/6EXh1bE1l5+2qnOQPctGCV6wHGRQQV1quM54HDA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 22 Sep 2024 23:56:45 +0200 Message-ID: <20240922215645.1182935-10-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 10/10] avcodec/xan: Add basic input size check 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: sR4XHO6eOGY6 Fixes: Timeout Fixes: 71739/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XAN_WC3_fuzzer-6170301405134848 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpe Signed-off-by: Michael Niedermayer --- libavcodec/xan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/xan.c b/libavcodec/xan.c index cc0ecea5ebf..56675dbbb18 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -607,6 +607,9 @@ static int xan_decode_frame(AVCodecContext *avctx, AVFrame *frame, return AVERROR_INVALIDDATA; } + if (buf_size < 9) + return AVERROR_INVALIDDATA; + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret;