<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>254410</bug_id>
          
          <creation_ts>2023-03-24 06:15:15 -0700</creation_ts>
          <short_desc>[CG] Handle properly the case when an image does not have a valid output colorspace</short_desc>
          <delta_ts>2023-03-27 23:01:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Images</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>254406</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=229021</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Said Abou-Hallawa">sabouhallawa</reporter>
          <assigned_to name="Said Abou-Hallawa">sabouhallawa</assigned_to>
          <cc>sabouhallawa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1943694</commentid>
    <comment_count>0</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2023-03-24 06:15:15 -0700</bug_when>
    <thetext>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&lt;DestinationColorSpace&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1943695</commentid>
    <comment_count>1</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2023-03-24 06:15:27 -0700</bug_when>
    <thetext>rdar://107103646</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1943696</commentid>
    <comment_count>2</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2023-03-24 06:16:17 -0700</bug_when>
    <thetext>rdar://107103646</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1943702</commentid>
    <comment_count>3</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2023-03-24 06:25:14 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit-security/pull/33</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1943754</commentid>
    <comment_count>4</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2023-03-24 08:50:01 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/11928</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1944503</commentid>
    <comment_count>5</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2023-03-27 23:01:38 -0700</bug_when>
    <thetext>This is already fixed by bug 254406.

*** This bug has been marked as a duplicate of bug 254406 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>