<?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>230855</bug_id>
          
          <creation_ts>2021-09-27 13:21:35 -0700</creation_ts>
          <short_desc>Canvas memory limit of 4096 × 4096 pixels when calling ctx.getImageData</short_desc>
          <delta_ts>2025-05-05 07:12:21 -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>Canvas</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>macOS 11</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=230887</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=144335</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="Bramus">bramus</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>daniel</cc>
    
    <cc>dino</cc>
    
    <cc>ik</cc>
    
    <cc>jarek</cc>
    
    <cc>kevin_neal</cc>
    
    <cc>lwarlow</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>thorton</cc>
    
    <cc>vepomoc</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1797613</commentid>
    <comment_count>0</comment_count>
    <who name="Bramus">bramus</who>
    <bug_when>2021-09-27 13:21:35 -0700</bug_when>
    <thetext>Spotted on Twitter [1], by Rik Schennink

“Safari 15 has a canvas memory limit of 4096 × 4096 pixels where Safari 14 could deal with resolutions up to 16384 x 16384”

Can verify via the CodePen Demo [2] Rik also shared, in which he creates a 4097x4097 canvas. Upon calling `ctx.getImageData(0, 0, size, size)` the code fails.

“Unable to get image data from canvas. Requested size was 4097 x 4097”

While searching for bugs I did find [3] where the limit was added for iOS, but this is now applied on macOS too apparently. Is this a regression?

[1] https://twitter.com/rikschennink/status/1442443774748082185
[2] https://codepen.io/rikschennink/pen/YzQRdwZ
[3] https://bugs.webkit.org/show_bug.cgi?id=145998</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1797614</commentid>
    <comment_count>1</comment_count>
    <who name="Bramus">bramus</who>
    <bug_when>2021-09-27 13:23:15 -0700</bug_when>
    <thetext>I read in https://bugs.webkit.org/show_bug.cgi?id=229237 that the “2D memory limit” test got marked as expected to Crash, so I guess that that explains why this went undetected?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1797797</commentid>
    <comment_count>2</comment_count>
    <who name="Bramus">bramus</who>
    <bug_when>2021-09-28 02:40:03 -0700</bug_when>
    <thetext>Update: Creating a canvas of 16384 x 16384 on macOS and drawing on it still works. It&apos;s only when calling `ctx.getImageData` that Safari fails to cooperate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1798337</commentid>
    <comment_count>3</comment_count>
    <who name="Kevin Neal">kevin_neal</who>
    <bug_when>2021-09-29 08:22:24 -0700</bug_when>
    <thetext>Thank you for filing. The appropriate engineers have been notified.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1798338</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-09-29 08:22:34 -0700</bug_when>
    <thetext>&lt;rdar://problem/83671710&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1803558</commentid>
    <comment_count>5</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2021-10-12 16:45:33 -0700</bug_when>
    <thetext>&lt;rdar://problem/83575501&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1803559</commentid>
    <comment_count>6</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2021-10-12 16:46:34 -0700</bug_when>
    <thetext>static const float MaxClampedLength = 4096;
static const float MaxClampedArea = MaxClampedLength * MaxClampedLength;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1803562</commentid>
    <comment_count>7</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2021-10-12 16:47:39 -0700</bug_when>
    <thetext>Might have been caused by https://bugs.webkit.org/show_bug.cgi?id=144335?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1803566</commentid>
    <comment_count>8</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-10-12 16:54:33 -0700</bug_when>
    <thetext>Or by the GPU Process?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>