LibGfx/JPEG2000: Fix off-by-one in reading comment data 😬

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.
This commit is contained in:
Nico Weber 2024-04-09 16:23:14 -04:00 committed by Tim Flynn
parent b2d7c405cd
commit 2c9c996130
Notes: sideshowbarker 2024-07-17 03:35:16 +09:00

View File

@ -453,7 +453,7 @@ static ErrorOr<Comment> read_comment(ReadonlyBytes data)
if (comment_type > 1)
return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Invalid comment type");
com.type = static_cast<Comment::CommentType>(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)