diff options
author | Nico Weber <thakis@chromium.org> | 2023-04-09 09:38:28 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-09 16:49:49 +0200 |
commit | 1f0b54c857bad4388b7f24505e548fb309fbd10b (patch) | |
tree | a3da68f3054d38b6b3a68c4afaebcf7823f8e5d6 /Userland/Libraries/LibGfx | |
parent | bed86fb57865e8967059154e958fe6e30004d68f (diff) | |
download | serenity-1f0b54c857bad4388b7f24505e548fb309fbd10b.zip |
LibGfx: Limit ICC-size-is-multiple-of-4 check to v4 files
The v2 spec doesn't require it, and it's not true in practice
(e.g. Compact-ICC-Profiles/profiles/sRGB-v2-nano.icc has size 410).
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r-- | Userland/Libraries/LibGfx/ICC/Profile.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGfx/ICC/Profile.cpp b/Userland/Libraries/LibGfx/ICC/Profile.cpp index 1f13d43e43..983304c453 100644 --- a/Userland/Libraries/LibGfx/ICC/Profile.cpp +++ b/Userland/Libraries/LibGfx/ICC/Profile.cpp @@ -74,7 +74,12 @@ ErrorOr<u32> parse_size(ICCHeader const& header, ReadonlyBytes icc_bytes) // ICC v4, 7.1.2: // "NOTE 1 This implies that the length is required to be a multiple of four." - if (header.profile_size % 4 != 0) + // The ICC v2 spec doesn't have this note. It instead has: + // ICC v2, 6.2.2 Offset: + // "All tag data is required to start on a 4-byte boundary" + // And indeed, there are files in the wild where the last tag has a size that isn't a multiple of four, + // resulting in an ICC file whose size isn't a multiple of four either. + if (header.profile_version_major >= 4 && header.profile_size % 4 != 0) return Error::from_string_literal("ICC::Profile: Profile size not a multiple of four"); return header.profile_size; |