LibGfx/JPEG2000: Check tile_part_length ("Psot") validity

This commit is contained in:
Nico Weber 2024-04-08 08:20:18 -04:00 committed by Tim Flynn
parent 1393719f10
commit 259c3fc7d3

View file

@ -249,6 +249,8 @@ static ErrorOr<void> parse_codestream_tile_header(JPEG2000LoadingContext& contex
tile_bitstream_length = context.codestream_data.size() - context.codestream_cursor - 2;
} else {
u32 tile_header_length = context.codestream_cursor - tile_start;
if (start_of_tile.tile_part_length < tile_header_length)
return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Invalid tile part length");
tile_bitstream_length = start_of_tile.tile_part_length - tile_header_length;
}