From patchwork Sun Sep 10 01:09:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43670 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4e27:b0:149:dfde:5c0a with SMTP id gk39csp1372066pzb; Sat, 9 Sep 2023 18:10:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFP2ZtFCuIyEzagVx2Z96RiH3DrbcdfMrlsGhRn3ihBYf3ARwJt379vi98AarnbCjTUw5VU X-Received: by 2002:aa7:c793:0:b0:523:bfec:4913 with SMTP id n19-20020aa7c793000000b00523bfec4913mr4723024eds.0.1694308206368; Sat, 09 Sep 2023 18:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694308206; cv=none; d=google.com; s=arc-20160816; b=z1A1i2qm9zwnkGfB3apwixn7Wn50YU3AAAqNw85pftuuJwc3RsEC/SDB+g/xPKZZvA vUpIxhlCZ/LGCo74Q7u6q+nbIqN0ACnxPhGO3kx5qUHLtj0+hiOyp+z22ovl0+NVGTZD NGTY+FUI/zeZVnzfG574Ps3UJITxzinpUutvD1PE1dceV3KJiRTCFceWCJ1YiYyb9/qG 109FC59lpKfTqaw003MULu78C8Y0dvbrVgRXfUz61cRYE4ojNjjpHYSYlvD2i5bdguW8 8+Cjf8L+2NPPZRiV5q8RUJDlR+DN84WwTqLjg14LXClM3HHXORvjCKXwJLXVbq+oNAmR JA+g== 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=daNESnCQXZznSpwM1X51y9ZC53TlVO105HWTwj/ESWI=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=SEXKBhFmC8QH8xKI7TwRo3atC79AqTpvdgX3rhOcCs0neEUaorRtSRYIPXugF9S/fY ufKliI9fxbgbeJNUWq3z+Ef/7Ug6F/tSmE7fJ99V+uaL2crDv6Ss/9XBADnMd7jsAXyY lSNXuXUDsKcoiReMCXrehLq4ThGxjGPajIVPaT4UwWOe1BWJd9asPFr1Ux0DRJcN+UUM TBgSxNq/W58rA/N6oCf6hdAgyMgj5AF7FKoeDgduWhEWj9/gW3mKqQUknWDOG2OEagTf rKJlslC4jwyMGkug+gAXfEiVlg5tnpbNsKDREicpBqw/nHUVGWve6nfNT7OrtBtvbD/x luiA== 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 p6-20020a056402074600b005233889544esi4100414edy.135.2023.09.09.18.10.05; Sat, 09 Sep 2023 18:10:06 -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 E89C168C8B6; Sun, 10 Sep 2023 04:10:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 94A3F68C6D5 for ; Sun, 10 Sep 2023 04:09:54 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id BE25A20004 for ; Sun, 10 Sep 2023 01:09:53 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 10 Sep 2023 03:09:50 +0200 Message-Id: <20230910010952.24389-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/wavarc: Use unsigned for samples in 1dif, 2slp, 5elp 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: lxhIVYwnakts Fixes: signed integer overflow: 141394472 + 2038060365 cannot be represented in type 'int' Fixes: 61787/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5882604925878272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/wavarc.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c index b954e8800cd..2e32b46ebd9 100644 --- a/libavcodec/wavarc.c +++ b/libavcodec/wavarc.c @@ -243,18 +243,18 @@ static int decode_1dif(AVCodecContext *avctx, break; case 3: for (int n = 0; n < s->nb_samples; n++) - samples[n + 4] = get_srice(gb, k) + (samples[n + 3] - samples[n + 2]) * 3 + + samples[n + 4] = get_srice(gb, k) + (samples[n + 3] - (unsigned)samples[n + 2]) * 3 + samples[n + 1]; finished = 1; break; case 2: for (int n = 0; n < s->nb_samples; n++) - samples[n + 4] = get_srice(gb, k) + (samples[n + 3] * 2 - samples[n + 2]); + samples[n + 4] = get_srice(gb, k) + (samples[n + 3] * 2U - samples[n + 2]); finished = 1; break; case 1: for (int n = 0; n < s->nb_samples; n++) - samples[n + 4] = get_srice(gb, k) + samples[n + 3]; + samples[n + 4] = get_srice(gb, k) + (unsigned)samples[n + 3]; finished = 1; break; case 0: @@ -343,13 +343,13 @@ static int decode_2slp(AVCodecContext *avctx, break; case 4: for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] = get_srice(gb, k) + (samples[n + 69] - samples[n + 68]) * 3 + + samples[n + 70] = get_srice(gb, k) + (samples[n + 69] - (unsigned)samples[n + 68]) * 3 + samples[n + 67]; finished = 1; break; case 3: for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] = get_srice(gb, k) + (samples[n + 69] * 2 - samples[n + 68]); + samples[n + 70] = get_srice(gb, k) + (samples[n + 69] * 2U - samples[n + 68]); finished = 1; break; case 2: @@ -359,7 +359,7 @@ static int decode_2slp(AVCodecContext *avctx, break; case 1: for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] = get_srice(gb, k) + samples[n + 69]; + samples[n + 70] = get_srice(gb, k) + (unsigned)samples[n + 69]; finished = 1; break; case 0: @@ -630,7 +630,7 @@ static int decode_5elp(AVCodecContext *avctx, case 20: case 7: for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] += ac_out[n] + samples[n + 69] * 3 - samples[n + 68] * 3 + samples[n + 67]; + samples[n + 70] += ac_out[n] + samples[n + 69] * 3U - samples[n + 68] * 3U + samples[n + 67]; finished = 1; break; case 19: @@ -653,14 +653,14 @@ static int decode_5elp(AVCodecContext *avctx, samples[n] = ac_pred[n]; for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] += ac_out[n] + samples[n + 69] * 3 - samples[n + 68] * 3 + samples[n + 67]; + samples[n + 70] += ac_out[n] + samples[n + 69] * 3U - samples[n + 68] * 3U + samples[n + 67]; finished = 1; break; case 18: case 5: for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] += ac_out[n] + samples[n + 69] * 2 - samples[n + 68]; + samples[n + 70] += ac_out[n] + samples[n + 69] * 2U - samples[n + 68]; finished = 1; break; case 17: @@ -672,7 +672,7 @@ static int decode_5elp(AVCodecContext *avctx, case 16: case 3: for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] += ac_out[n] + samples[n + 69]; + samples[n + 70] += ac_out[n] + (unsigned)samples[n + 69]; finished = 1; break; case 15: @@ -695,7 +695,7 @@ static int decode_5elp(AVCodecContext *avctx, samples[n] = ac_pred[n]; for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] += samples[n + 69] * 2 - samples[n + 68]; + samples[n + 70] += samples[n + 69] * 2U - samples[n + 68]; finished = 1; break; @@ -712,14 +712,14 @@ static int decode_5elp(AVCodecContext *avctx, for (int o = 0; o < order; o++) sum += s->filter[ch][o] * (unsigned)samples[n + 70 - o - 1]; - samples[n + 70] += ac_out[n] + (sum >> 4); + samples[n + 70] += (unsigned)ac_out[n] + (sum >> 4); } for (int n = 0; n < 70; n++) samples[n] = ac_pred[n]; for (int n = 0; n < s->nb_samples; n++) - samples[n + 70] += samples[n + 69]; + samples[n + 70] += (unsigned)samples[n + 69]; finished = 1; break; @@ -731,7 +731,7 @@ static int decode_5elp(AVCodecContext *avctx, for (int o = 0; o < order; o++) sum += s->filter[ch][o] * (unsigned)samples[n + 70 - o - 1]; - samples[n + 70] += ac_out[n] + (sum >> 4); + samples[n + 70] += (unsigned)ac_out[n] + (sum >> 4); } finished = 1; break; 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; From patchwork Sun Sep 10 01:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43672 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4e27:b0:149:dfde:5c0a with SMTP id gk39csp1372151pzb; Sat, 9 Sep 2023 18:10:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKpyhrc9klu26l2I4HiMEZYWE4GQbdepvJNYoSUbPZxPV0O3qoWBWL77G0Mqx0eMy+wB0h X-Received: by 2002:a2e:9b87:0:b0:2bc:c4ae:c565 with SMTP id z7-20020a2e9b87000000b002bcc4aec565mr4344721lji.28.1694308225506; Sat, 09 Sep 2023 18:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694308225; cv=none; d=google.com; s=arc-20160816; b=BSQ7dpVibynx8UN/t3EFSQJ/GFUe1LwAog//tgWe2C2MinXXaB/Xx2qFyRX1yIDBju b2lQbp32plFy2vEzBC66Gm/csLYyJXqijr8es1KQXSjfVImXl7a46HsAA0mVh0b2Uyi6 5LCSepseqx6Jj4vfYZQwYWHqZNmtw/qCVc78qI/Rf7PNjbwQEIV4H1QorhEJDEZUuXIK f5AvFKHfS4CRvp6Qemq+QyHTPwaMfa3jim2v+k9Xf4ya6ndvief9SlMCn47PX9E1oGeN GsbL78PADl4GDQQvfgYc7NMXz1hsOoS440qR1SltshtXoL3hYdr8MHj9e3j9oL9sjz1v qHmw== 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=Ikdtvbe5cXusrea1juRjVZ/0ndp/YzTLzfFboim0lbo=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=TuVtjc4nN1siyjuPVwP/6dUl4uv3CIowTrAhTW2R6u4rtrurlA1o412jgdRaXGh/qk TdvvlNe7ZT3u61WHJ7I6XDFdnzP27ydkgTK/+bwRvL4Sbt22XCleWw0rRmEeevbIcT8C sR5Sgqe+qPil4cTNkZC7kA3kBHCwBCzvkbHJXbqMgXSOPAuvZbILdJlGB3UKg0wiwXPg LsZgFO8RWHc++UvMTBn0D/1lAZs1jTWRgb+yXs+SDydUf6MD4l0MCJsCco7v6D9f/Xnh BqIABSdXrNVKtagp+0VREqR4bDL9tTAMm0QCEgwNQfmwWNjF+zX2gVJN6OC1XhNLed+w HmGA== 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 rn28-20020a170906d93c00b009874409d1e9si3713526ejb.200.2023.09.09.18.10.25; Sat, 09 Sep 2023 18:10:25 -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 06FFD68C8C8; Sun, 10 Sep 2023 04:10:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E31C968C8B5 for ; Sun, 10 Sep 2023 04:09:56 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3FB1640004 for ; Sun, 10 Sep 2023 01:09:55 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 10 Sep 2023 03:09:52 +0200 Message-Id: <20230910010952.24389-3-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 3/3] avcodec/jpegxl_parser: Check for ctx->skip overflow 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: W+JuxXyHXeUJ Fixes: out of array access Fixes: 62113/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5025082076168192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/jpegxl_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c index 20c8a41a89b..619a16448fa 100644 --- a/libavcodec/jpegxl_parser.c +++ b/libavcodec/jpegxl_parser.c @@ -1326,7 +1326,7 @@ static int skip_boxes(JXLParseContext *ctx, const uint8_t *buf, int buf_size) if (!size) return AVERROR_INVALIDDATA; /* invalid ISOBMFF size */ - if (size <= head_size + 4) + if (size <= head_size + 4 || size > INT_MAX - ctx->skip) return AVERROR_INVALIDDATA; ctx->skip += size;