Bug 254410

Summary: [CG] Handle properly the case when an image does not have a valid output colorspace
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: ImagesAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: sabouhallawa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=229021

Said Abou-Hallawa
Reported 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.
Attachments
Said Abou-Hallawa
Comment 1 2023-03-24 06:15:27 PDT
Said Abou-Hallawa
Comment 2 2023-03-24 06:16:17 PDT
Said Abou-Hallawa
Comment 3 2023-03-24 06:25:14 PDT
Said Abou-Hallawa
Comment 4 2023-03-24 08:50:01 PDT
Said Abou-Hallawa
Comment 5 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 ***
Note You need to log in before you can comment on or make changes to this bug.