From 2c9c996130cab5a9eac42d8493363f266664e1a0 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 9 Apr 2024 16:23:14 -0400 Subject: [PATCH] =?UTF-8?q?LibGfx/JPEG2000:=20Fix=20off-by-one=20in=20read?= =?UTF-8?q?ing=20comment=20data=20=F0=9F=98=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For text, we always ended up with a leading \0 byte (on little-endian), which prints as nothing. Since that's the only thing we do with this data, no actual behavior change. --- Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp b/Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp index 27c92746808..ba18cca991d 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp @@ -453,7 +453,7 @@ static ErrorOr read_comment(ReadonlyBytes data) if (comment_type > 1) return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Invalid comment type"); com.type = static_cast(comment_type); - com.data = data.slice(1); + com.data = data.slice(2); dbgln_if(JPEG2000_DEBUG, "JPEG2000ImageDecoderPlugin: COM marker segment: comment_type={}, size()={}", (int)com.type, com.data.size()); if (com.type == Comment::ISO_IEC_8859_15)