Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libpng18] [bug fix] Adjust colorspace calculations for ACES AP0 #609

Merged
merged 1 commit into from
Oct 6, 2024

Conversation

jbowler
Copy link
Contributor

@jbowler jbowler commented Oct 1, 2024

The subtracts in PNG_XYZ_from_xy are producing integer overflow with
some valid but extreme xy values. This re-introduces the previous
checks, but with less limited bounds; sufficient to accomodate the
ACEScg end points (ACES AP1), but not for the ACES AP0 end points.
Those were not working anyway because libpng reads the cHRM parameters
as unsigned values, so they must always be at least 0.

A better solution requires recognizing reasonable negative values (ones
which violate the current spec) and allowing them too, at least on read.

Reviewed-by: Cosmin Truta [email protected]
Signed-off-by: John Bowler [email protected]
Signed-off-by: Cosmin Truta [email protected]

The subtracts in PNG_XYZ_from_xy are producing integer overflow with
some valid but extreme xy values.  This re-introduces the previous
checks, but with less limited bounds; sufficient to accomodate the
ACEScg end points (ACES AP1), but not for the ACES AP0 end points.
Those were not working anyway because libpng reads the cHRM parameters
as unsigned values, so they must always be at least 0.

A better solution requires recognizing reasonable negative values (ones
which violate the current spec) and allowing them too, at least on read.

Reviewed-by: Cosmin Truta <[email protected]>
Signed-off-by: John Bowler <[email protected]>
Signed-off-by: Cosmin Truta <[email protected]>
@jbowler
Copy link
Contributor Author

jbowler commented Oct 1, 2024

Since I've dropped trying to fix the math problems in general there is no merit to fixing them here so this change should now go in to libpng18.

@jbowler jbowler changed the title fix: Adjust colorspace calculations for ACES AP0 [libpng18] [bug fix] Adjust colorspace calculations for ACES AP0 Oct 3, 2024
@ctruta ctruta merged commit ec53479 into pnggroup:libpng18 Oct 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants