From patchwork Mon Jun 27 08:43:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 36483 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp1881158pzh; Mon, 27 Jun 2022 01:44:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1umTFI2fef3v1LNRSmPfBkjci4YEtyMKuXN8x+ybr3ICdjsfdxJ3u03OgqYIAz1Tld9TfJL X-Received: by 2002:a17:906:b1c1:b0:726:b009:4b63 with SMTP id bv1-20020a170906b1c100b00726b0094b63mr1990818ejb.24.1656319440321; Mon, 27 Jun 2022 01:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656319440; cv=none; d=google.com; s=arc-20160816; b=YuuH6qQrP+H/lDAbEBqTp+CUPuKTfeNt0RN7INs7S0lLUT/3xUEL9t6KL4+Uw4pPQX 88urn5zMOgpyZWi7QSz4vzHmVKJxLR7roQtLfZjPtD0MX3hjCdGJ9vihVXNQBAj4V4ad j/L30/jbihd8CX7OboXwT6TsL9atwJlnmYOrP3pBg8/PZwsJdTV2e4n8S5LCkBL2msGS iPOYYqssodzPTpmxKL4VEz9Cy+PSbhjMvlK63JuENQozCpYBFo6rhVq6ZCQJmYaWoqvl S5Nv11IHftGG+cq3LQRHR2ImrzVdxFDq83FPCv8ffjmwhfp07y8BiVBuSCxDE7djm14S Jjxg== 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:message-id:date:to:from:delivered-to; bh=A3uMAubTzQRdwHOkw+D7BwOxshpsH48VuQE61Axb6Cc=; b=h/eD/0MudIin4DWnicQ7bB0NuYs3I8xXCyWyp5SbCbPdpBh+Pkhvmwg0VAOFyXlW+y N/2gSWo2a4j7wh+x0fmdOosI5u9m0QpLjkdEVY4gOTQlkDMhUG+Wv9SzMeJhBIoWo1W5 vZA3ypHSPm1ST/+yr7WD0+60vmoNCobLWNjvbFSSjoQmODLCIiBq59fV4n0CNQuEqotp +Y/wsIFgdYSdkfh8jF8vYzvLgOT0KdlB7anycdn/S5FW16Pkw98QfMzFWmrCKnoNPiK0 xrRepn04EACtYFioADBjDzE7sj9fSEt7mDivXL3muibFezmElv1j4dEcFJxC5U0W2jy2 ubng== 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 dm3-20020a170907948300b00726bea57a9csi247749ejc.662.2022.06.27.01.43.59; Mon, 27 Jun 2022 01:44:00 -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 771F968B8C9; Mon, 27 Jun 2022 11:43:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at01-1.mx.upcmail.net (vie01a-dmta-at01-1.mx.upcmail.net [62.179.121.145]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CAA1768B6B1 for ; Mon, 27 Jun 2022 11:43:49 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at01.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1o5kLU-00CWSx-UJ for ffmpeg-devel@ffmpeg.org; Mon, 27 Jun 2022 10:43:48 +0200 Received: from ren-mail-psmtp-mg02. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 5kKVoPCpJ8s8U5kLUoDxdB; Mon, 27 Jun 2022 10:43:48 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg02. with ESMTP id 5kLUo2B0G8eSW5kLUogwiL; Mon, 27 Jun 2022 10:43:48 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.4 cv=KKE5sHJo c=1 sm=1 tr=0 ts=62b96dc4 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=CE3kdVnW5LIsAuskuU0A:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 27 Jun 2022 10:43:47 +0200 Message-Id: <20220627084347.30362-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfENUQuPIGfHfjRGeaJGioLBGkaDYvGN8OuIIV95dBEWboo8IidewXCrtcq/VNv4QqEVfPiuqdsZANAHLxgDISc01d+JRuPRlxrk/lDjzR6i+wv1/SVov ueNRkvhp5tvNtjAttOYZmETxQkbUPKTrdFUq6dynqxEuHQ/78ra8cHKLeRAL+e2BC+vPZtnEQT7oog== Subject: [FFmpeg-devel] [PATCH] avformat/aaxdec: Check for empty segments 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: bZyChnlc8+0a Fixes: Timeout Fixes: 48154/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-5149094353436672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/aaxdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c index dd1fbde736..bcbff216db 100644 --- a/libavformat/aaxdec.c +++ b/libavformat/aaxdec.c @@ -252,6 +252,8 @@ static int aax_read_header(AVFormatContext *s) size = avio_rb32(pb); a->segments[r].start = start + a->data_offset; a->segments[r].end = a->segments[r].start + size; + if (!size) + return AVERROR_INVALIDDATA; if (r && a->segments[r].start < a->segments[r-1].end && a->segments[r].end > a->segments[r-1].start)