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 EF98544DD0 for ; Thu, 23 Nov 2023 23:46:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 41A9468CEEB; Fri, 24 Nov 2023 01:45:55 +0200 (EET) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1F17868CB87 for ; Fri, 24 Nov 2023 01:45:47 +0200 (EET) Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3b2d9a9c824so303736b6e.0 for ; Thu, 23 Nov 2023 15:45:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700783145; x=1701387945; 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=adJqK8qka9lLzSL6KDUnIPhn3BHtDCphe73Uwh23MlgXD4oFAeSJE/Efxvqhp/gu/Y mnP6IrOaOs/ZWlB03GDVdPDX4ILrYkrJorSOWWEomTnWhsy2IVlX8Ainlg4HOGr/JKy1 hltfugUjc8N2Wc0pBBI4qQ1gW974wFZULf6G115hso4F0Ui/JbJSW8oEmAXeEAWXdvH9 cK4DSyk9t/3Bx760evFyCqLLAdPx2clpGTl3m5k3B8PlWDw9pZl8cRD21DHuamGv/Sgf +rPB+ZMxxbq6Ah4Am+aEG0gibYgSpgdKXeA/+FDQpu3/7DiMEui5/j8rMJGRzJxRuN8T GRXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700783145; x=1701387945; 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=gshW6xnijBKd3v8eE9CtHnTmXvUpDJWNPgq0J1UbYhVMnq9S1NDa8g0wRJWsX1LSsh UixZVAtJL8n2oI+ateDkHayhbCF+cNy/vy+da75N3Do0aTUMUsV9ZfG8BqwkG4utdLnX 6wQLC/yixz3boaauq8sRipofVPoo5+h5ymu+38icjMgR94jwM1EZ6+mNI0muPhGPRp00 DU2w4SVUZ4dJH99vSTQHQZhCy9O374vyFZKa0BDV+HhCLg/NSF72rZBD4u+HIXMpkKhu Np98+qhsvny+A7VO6uRQim5008v5hfE4u/LFFp1T3KByRI1ktfMDFS0Gyzz1g1Pb67OF kzvg== X-Gm-Message-State: AOJu0YzFOehgs2xyrll0MnHk0nnh8Mk7t9WPD4yC7pnRmrMEvYBN9Sjd kU5hqmXORrb2BkDxxdsffqNNIGPKnpM= X-Google-Smtp-Source: AGHT+IGhQLhU4HkZBo8XDh807cyGKjuW4vw+67G4y63W0x5MQjI43rCEghxa+pcZnEy/7aQAAirMAg== X-Received: by 2002:a05:6358:71d:b0:16d:abd9:f29e with SMTP id e29-20020a056358071d00b0016dabd9f29emr712915rwj.2.1700783145362; Thu, 23 Nov 2023 15:45:45 -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 dy20-20020ad44e94000000b0067a14f54f8asm110601qvb.50.2023.11.23.15.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 15:45:45 -0800 (PST) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 Nov 2023 18:45:41 -0500 Message-ID: <20231123234541.41316-3-leo.izen@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231123234541.41316-1-leo.izen@gmail.com> References: <20231123234541.41316-1-leo.izen@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] 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".