1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:27:35 +00:00

LibGfx+icc: Verify ICCProfile ID at parse time instead of in icc

Always computing computing the md5 takes some time, but most
icc profiles are small. So that's probably fine.

If this ends up being a perf problem in the future, or if it ends up
rejecting tons of embedded proiles from images, we can row it back.
But let's see if we can get away with this first.
This commit is contained in:
Nico Weber 2023-01-06 13:46:18 -05:00 committed by Linus Groh
parent 31af741c66
commit c00ce2fba0
2 changed files with 9 additions and 12 deletions

View file

@ -40,14 +40,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
outln("pcs illuminant: {}", profile->pcs_illuminant());
out("id: ");
if (auto id = profile->id(); id.has_value()) {
out("{}", *id);
auto computed = Gfx::ICC::Profile::compute_id(icc_file->bytes());
if (*id == computed)
outln(" (valid)");
else
outln(" (invalid! valid would be {})", computed);
} else
if (auto id = profile->id(); id.has_value())
outln("{}", *id);
else
outln("(not set)");
return 0;