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 87D4347E06 for ; Mon, 27 Nov 2023 14:10:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5232268CF21; Mon, 27 Nov 2023 16:10:24 +0200 (EET) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 78DF268CD3F for ; Mon, 27 Nov 2023 16:10:14 +0200 (EET) Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-77773d3246aso3173485a.1 for ; Mon, 27 Nov 2023 06:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701094213; x=1701699013; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FBbZANov46ynIfWYgvrkbCcQDXJVS2J3qSQa6VJhbNw=; b=WnnttLh28dpbUBdj1rsOuDMI4MiKJUSpNizIySZxmIXWIoqnDK8SWklpR3iTlnHp4F 30A2n9Zu1kBWHesus4AVlpYKVPYckZTFi6S8r+QGNonf7ncFZVR81645+UkgN5c+oveS vBcqqmQPdDIdkPHhF7heV6HNzYf5faMjrl5h6zioygpKvnaFiADj4xdUmgohjqQ2HNPD QTU4LLdS9cx0kpCUAAgkjOXvph4HkKPw8ZFoDzaAcpsu9pczLnUWVpCFUpzUYLbn7imY YFvSnmhH9w253JC9EPtVoVRTpG1JAS4zJ/NEZKbpfPENCM/Kgg1cDDLyBWOP7zvkNXiO JCzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701094213; x=1701699013; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FBbZANov46ynIfWYgvrkbCcQDXJVS2J3qSQa6VJhbNw=; b=NlcHbQoBqtihbHfCyoBXrX5JZ3NbZj+5iKK5zZL6qRAm35nBBg7ZSazywFZXJCa9iK +EDcASiM2HBa9SGh/yewlfcRiBHRU2q9J2TMbzfEUG8wyIcv3v1gmz84C5xf5VJ9Psx/ UCH8+QzyIb3iYw4MBC/MNVbaMQlHFzdxEjyz9LQ96REB79ZlaCjc/ZZFVgRh1Zelo4q/ vTh/9s26GfO/MlxOfPLtZTUF8F5ioCpvjT1aFwcOo5yXG8kdHcQ4mU5JeKKWuCe7DH1g rPNQiwvQ9MPtJWzq5Qdk6ndFlhx2If3I0ZYtjSX2+PqiDXyoRW9oRkzbSRwAze06kNLZ V4sw== X-Gm-Message-State: AOJu0Yz2YyuwwnqQkuzmzaqfo2dQrDuXMZPLG4/nMzcQD4bpVKUsZTMh wH+9u6VnJ57h36anDs3ikhwpyKqxQjQ= X-Google-Smtp-Source: AGHT+IGLO++bup0QJUrv0KScSxvxktKz9XxMXqPIsZml960MWMoNxTVMZ+qK4EjPGFHsT8Mc+NJLQw== X-Received: by 2002:a05:620a:25d3:b0:773:a789:cd15 with SMTP id y19-20020a05620a25d300b00773a789cd15mr12691765qko.6.1701094213142; Mon, 27 Nov 2023 06:10:13 -0800 (PST) Received: from gauss.local (c-68-56-149-176.hsd1.mi.comcast.net. [68.56.149.176]) by smtp.gmail.com with ESMTPSA id tp13-20020a05620a3c8d00b0077d72f820adsm3699365qkn.115.2023.11.27.06.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:10:12 -0800 (PST) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Nov 2023 09:10:07 -0500 Message-ID: <20231127141008.183621-3-leo.izen@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231127141008.183621-1-leo.izen@gmail.com> References: <20231127141008.183621-1-leo.izen@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/3] avcodec/jpegxl_parser: fix parsing sequences of extremely small files 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 Cc: Leo Izen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This patch allows the JXL parser to parse sequences of extremely small files concatenated together. (e.g. smaller than the parser buffer) Signed-off-by: Leo Izen --- libavcodec/jpegxl_parser.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c index 750872f17f..006eb6b295 100644 --- a/libavcodec/jpegxl_parser.c +++ b/libavcodec/jpegxl_parser.c @@ -1454,15 +1454,21 @@ static int jpegxl_parse(AVCodecParserContext *s, AVCodecContext *avctx, { JXLParseContext *ctx = s->priv_data; int next = END_NOT_FOUND, ret; + const uint8_t *pbuf = ctx->pc.buffer; + int pindex = ctx->pc.index; *poutbuf_size = 0; *poutbuf = NULL; - if (!ctx->pc.index) - goto flush; + if (!ctx->pc.index) { + if (ctx->pc.overread) + goto flush; + pbuf = buf; + pindex = buf_size; + } if ((!ctx->container || !ctx->codestream_length) && !ctx->next) { - ret = try_parse(s, avctx, ctx, ctx->pc.buffer, ctx->pc.index); + ret = try_parse(s, avctx, ctx, pbuf, pindex); if (ret < 0) goto flush; ctx->next = ret; @@ -1471,7 +1477,7 @@ static int jpegxl_parse(AVCodecParserContext *s, AVCodecContext *avctx, } if (ctx->container && ctx->next >= 0) { - ret = skip_boxes(ctx, ctx->pc.buffer, ctx->pc.index); + ret = skip_boxes(ctx, pbuf, pindex); if (ret < 0) { if (ret == AVERROR_INVALIDDATA) ctx->next = -1; -- 2.43.0 _______________________________________________ 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".