From patchwork Sun Sep 10 01:09:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43671 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4e27:b0:149:dfde:5c0a with SMTP id gk39csp1372112pzb; Sat, 9 Sep 2023 18:10:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHw/LyOQDxFYDvAq3cxwBNUAYG70VH8gXLGcTwxEpfBapg6YVCvGSSvUzCVsgTTj0VP7di8 X-Received: by 2002:a05:6512:398a:b0:4fd:d213:dfd4 with SMTP id j10-20020a056512398a00b004fdd213dfd4mr5823787lfu.20.1694308216433; Sat, 09 Sep 2023 18:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694308216; cv=none; d=google.com; s=arc-20160816; b=hnDCPNpHyNFqWT5iiPn/fosrL0syob9Uv74Uf5FSKr/Qy2QcqdGVL5Vh30dKartiV8 0f8Sb8rblj4NAE8kPK7pD/yi2TWgEYr1k/9K69ZWHpE7btqCldjHHwfFBLwu9uJqBAba JOFCtLIeRaEhCinj2fdAM67owNRBWlaEZ6iH4mxN8irDWj3yQIA1frtLnu4hGmA3b/YG Ri6Y4CUwYA7Zfx+2Yq9Qr3zq0aCKyhem/L9T31F17urfm1UVdNC848Bmk1rePwRo4gnY 3w1/Neg818q1H8u1C51xOsNB+zi1982aouHT5GdvlTYNbkt4MXeFCrPCxg2cCm03jk+l cXww== 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=8P3rO/SZIBOIMQGQSvLr/g9lHo0wZypdFcT2YJwdKgc=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=XQBK1C/I2F3B/lsJplw03WiepcjWWlnSbgOaz4hUFlFbKqieLIYrqCAV36vxjdwRoQ XyXadgcDvtZ9q+nuEayVLRToldlApWFde3dXAoN4MJUgvrbHWjsiz7qGEr2yipXwWtgh PH1cfHBYkjbB/w8axh45XSKVUgFI3itFE5sJsQohVJ8i0iPvK7uhVymt741/eMogtCVW W1FE7jIepjf0ccfbe0SRPLHb1agO1cVde85CQvfH+8nEt+oyMYTcvFrnFQtcg11ujRK7 z5W7AGolO2JhbIpvfZr/8ZOvVIpNVTk2nfzu6QTPPwMfaFmWWPJxG6AhIH1BXXXw+iwx KvRw== 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 b6-20020a170906490600b009828e8bec17si3974051ejq.531.2023.09.09.18.10.15; Sat, 09 Sep 2023 18:10:16 -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 0A15F68C8BE; Sun, 10 Sep 2023 04:10:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E35E568C49B for ; Sun, 10 Sep 2023 04:09:55 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 213271BF203 for ; Sun, 10 Sep 2023 01:09:54 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 10 Sep 2023 03:09:51 +0200 Message-Id: <20230910010952.24389-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230910010952.24389-1-michael@niedermayer.cc> References: <20230910010952.24389-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/3] avformat/jpegxl_anim_dec: Check that size fits within argument 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: 6kv4D/RTtNvm Fixes: out of array access Fixes: 61991/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5524679648215040 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/jpegxl_anim_dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c index fc95a1781f6..54cd6e4e9d6 100644 --- a/libavformat/jpegxl_anim_dec.c +++ b/libavformat/jpegxl_anim_dec.c @@ -152,6 +152,8 @@ static int jpegxl_anim_read_packet(AVFormatContext *s, AVPacket *pkt) size = avio_size(pb); if (size < 0) return size; + if (size > INT_MAX) + return AVERROR(EDOM); if (size == 0) size = 4096;