From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3F160410CF for ; Mon, 12 Jun 2023 01:14:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5AA9768C329; Mon, 12 Jun 2023 04:14:05 +0300 (EEST) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3CC3268C049 for ; Mon, 12 Jun 2023 04:13:59 +0300 (EEST) Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6b2daf66f3cso112964a34.0 for ; Sun, 11 Jun 2023 18:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686532437; x=1689124437; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=fkeBpCCN/hUA8btMuYFS9IPqiGFrxVRHnEeJWRubRHE=; b=mZzitIKEV+cVCCHq9tuO9sWotaGl+fcla3ak92Wl/mLHo5ngpu9GrXsiJELo0BDGym bhbhI72dWBXgDmno10lXOWixFQi/HKW7ruq6SNn4LSM9LzbfDo67reNijWqum9jb1KIW tQKbpSQ5cMElpIa/DFwc9tIfSyomNfRpUaYUO8DytyzWpC4M2QXRty4O7zBiNT+2Ecp9 D6K05ICwdWDwW2RViaZ7t4cvo7pmnZUGJCQ0z7ZCEu9KlSZbZ5wVEqqSwoMOHQ77/sHg NOUg12+nD/RfqS3zBQZNHkFB/bKfDjTMTWfqse99yLb1ClwCX+ewTFZqE5pcMvX22kiW IPpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686532437; x=1689124437; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fkeBpCCN/hUA8btMuYFS9IPqiGFrxVRHnEeJWRubRHE=; b=k96z78VyZ0WEG/Jo2Dhh/efz3OqVp7DS3DXn+ZlZMjdl1nYyPQABJoCzN3OBns9CXZ PwKf+9YvTBFSOS//v8SSkCv07l5A0JkRYSIUc7qvvGRZi5mhvglHVKoSX54Lt2Y4gCHD TVuBdQvdiO8SehIvmnL/C8oiedD81To1AY4D+Upw5gIhAjDNCqXm2cDVJcWsMyQyWflm EXD2MmONKfL4B+cQ9RorEbHNuknF190kqm8Ib3fYUuWT74m1VLkacvv2KUD8V4g7mzak D1lAPcmBwHTqknoEU7K02ivFeN0ANPAc/23Zgxt8XaD3sUhi7m2u1w97rHcieohVnNYa F4eA== X-Gm-Message-State: AC+VfDxrNXnTfWgO46wwtN84q6p28rCfWZJrEuQ9jqmCYK+exZzu6wTd 3Domv99z1XsR+FDPpqRjDRUel9gDPho= X-Google-Smtp-Source: ACHHUZ766iAKAUKpZk60PT+yBirKRaWZy9OElXJI4C/0RgjfONwjJPfdW0+NYWCXE0SAHWtkqPMWUQ== X-Received: by 2002:a05:6358:cd1b:b0:129:c26d:e5ec with SMTP id gv27-20020a056358cd1b00b00129c26de5ecmr1962978rwb.3.1686532436802; Sun, 11 Jun 2023 18:13:56 -0700 (PDT) Received: from [192.168.1.35] (c-98-224-219-15.hsd1.mi.comcast.net. [98.224.219.15]) by smtp.gmail.com with ESMTPSA id a186-20020a0df1c3000000b0056d05c32ca5sm975434ywf.20.2023.06.11.18.13.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Jun 2023 18:13:56 -0700 (PDT) Message-ID: Date: Sun, 11 Jun 2023 21:13:55 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 To: FFmpeg development discussions and patches References: <20230608142637.45033-1-leo.izen@gmail.com> <20230608142637.45033-6-leo.izen@gmail.com> <168627783435.3843.4945183301920846571@lain.khirnov.net> Content-Language: en-US-large From: Leo Izen In-Reply-To: <168627783435.3843.4945183301920846571@lain.khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 5/5] avformat/jpegxl_anim_dec: avoid overrun with jxlp boxes in container 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 6/8/23 22:30, Anton Khirnov wrote: > Quoting Leo Izen (2023-06-08 16:26:37) >> This should avoid overrunning buffers with jxlp boxes if the size is >> zero or if the size is so small the box is invalid. >> >> Signed-off-by: Leo Izen >> --- >> libavformat/jpegxl_anim_dec.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c >> index 6ea6c46d8f..c9e4dcd5fc 100644 >> --- a/libavformat/jpegxl_anim_dec.c >> +++ b/libavformat/jpegxl_anim_dec.c >> @@ -76,8 +76,14 @@ static int jpegxl_collect_codestream_header(const uint8_t *input_buffer, int inp >> tag = AV_RL32(b); >> b += 4; >> if (tag == MKTAG('j', 'x', 'l', 'p')) { >> + if (b - input_buffer >= input_len - 4) >> + break; >> b += 4; >> - size -= 4; >> + if (size) { >> + if (size < 4) >> + return AVERROR_INVALIDDATA; >> + size -= 4; >> + } > > This looks like it should be using bytestream2. Is there a good reason > it is not? > No particular reason, I'll send an updated patch using it. Also, I pushed the first three patches that michaelni authored, but not the 4th or this one. - Leo Izen _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".