LibGfx/JPEG2000: Allow COD, COC, QCD, QCC, RGN only in first tile-part

(The FIXME was incomplete, it didn't mention RGN also only being valid
in a tile's first tile-part header.)
This commit is contained in:
Nico Weber 2024-04-08 21:10:00 -04:00 committed by Tim Flynn
parent 1df5c01bfb
commit 7b7ef7dcc7

View file

@ -597,12 +597,14 @@ static ErrorOr<void> parse_codestream_tile_header(JPEG2000LoadingContext& contex
context.codestream_cursor += 2;
found_start_of_data = true;
break;
// FIXME: COD, COC, QCD, QCC are only valid on the first tile part header, reject them in non-first tile part headers.
case J2K_COD:
case J2K_COC:
case J2K_QCD:
case J2K_QCC:
case J2K_RGN:
if (start_of_tile.tile_part_index != 0)
return Error::from_string_literal("JPEG2000ImageDecoderPlugin: COD, COC, QCD, QCC, RGN markers are only valid in the first tile-part header");
[[fallthrough]];
case J2K_POC:
case J2K_PPT:
case J2K_PLT: