Bug 254410 - [CG] Handle properly the case when an image does not have a valid output colorspace
Summary: [CG] Handle properly the case when an image does not have a valid output colo...
Status: RESOLVED DUPLICATE of bug 254406
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-03-24 06:15 PDT by Said Abou-Hallawa
Modified: 2023-03-27 23:01 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2023-03-24 06:15:15 PDT
NativeImage::colorSpace() always creates DestinationColorSpace from the return of CGImageGetColorSpace() without checking its value which can be null. We need to check the image colorspace is CGColorSpaceSupportsOutput() before creating DestinationColorSpace. CGColorSpaceSupportsOutput() will return false for a null input.

We can make the return type of NativeImage::colorSpace() std::optional<DestinationColorSpace> and make it return std::nullopt if CGColorSpaceSupportsOutput() returns false. We should let the caller decide what to do when the image does not have a valid DestinationColorSpace.
Comment 1 Said Abou-Hallawa 2023-03-24 06:15:27 PDT
rdar://107103646
Comment 2 Said Abou-Hallawa 2023-03-24 06:16:17 PDT
rdar://107103646
Comment 3 Said Abou-Hallawa 2023-03-24 06:25:14 PDT
Pull request: https://github.com/WebKit/WebKit-security/pull/33
Comment 4 Said Abou-Hallawa 2023-03-24 08:50:01 PDT
Pull request: https://github.com/WebKit/WebKit/pull/11928
Comment 5 Said Abou-Hallawa 2023-03-27 23:01:38 PDT
This is already fixed by bug 254406.

*** This bug has been marked as a duplicate of bug 254406 ***