<?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>283351</bug_id>
          
          <creation_ts>2024-11-19 01:52:33 -0800</creation_ts>
          <short_desc>[Skia] Ensure correct SkPixmap::[writable_]addr*() methods are used for image data access</short_desc>
          <delta_ts>2026-03-30 15:44:17 -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>Layout and Rendering</component>
          <version>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=311095</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="Adrian Perez">aperez</reporter>
          <assigned_to name="Adrian Perez">aperez</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2076079</commentid>
    <comment_count>0</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2024-11-19 01:52:33 -0800</bug_when>
    <thetext>The SkPixmap::[writable_]addr{8,16,32,64,F16}() functions include assertions
(which may be enabled via the SKIA_DEBUG=ON CMake option) that check whether
the pixel format bit width matches the intended usage of the method. For
example ::addr32() works with ARGB8888/BGRA8888/etc. but will crash on the
assertion with an RGB565 image.

We should audit the call sites for these functions and make sure the correct
ones are used. When handling can be generic regardless of the pixel format
bit widthl, usage must be replaced with the unsuffixed ::[writable_]addr()
functions instead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2077692</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-11-26 01:54:04 -0800</bug_when>
    <thetext>&lt;rdar://problem/140575154&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195249</commentid>
    <comment_count>2</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2026-03-30 13:09:29 -0700</bug_when>
    <thetext>Heh, I am now hitting an assertion related to this, after 310215@main (see bug #311095):

  Thread 1 &quot;TestWebKitFavic&quot; received signal SIGILL, Illegal instruction.
  sk_abort_no_print () at /sdk/webkit/Source/ThirdParty/skia/src/ports/SkMemory_malloc.cpp:60
  60          __builtin_trap();
  (gdb) up                                                                                                                                                                                                                                       
  #1  0x00007fffedc53f72 in SkPixmap::addr8() const::{lambda()#1}::operator()() const (this=0x7fffffffbfc7) at Skia/Headers/top/skia/core/SkPixmap.h:327
  327             SkASSERT(1 == fInfo.bytesPerPixel());
  (gdb) up
  #2  0x00007fffedc53f0a in SkPixmap::addr8 (this=0x7fffffffc0a8) at Skia/Headers/top/skia/core/SkPixmap.h:327
  327             SkASSERT(1 == fInfo.bytesPerPixel());
  (gdb) up
  #3  0x00007fffedc53dc5 in SkPixmap::addr8 (this=0x7fffffffc0a8, x=0, y=0) at Skia/Headers/top/skia/core/SkPixmap.h:401
  401             return (const uint8_t*)((const char*)this-&gt;addr8() + (size_t)y * fRowBytes + (x &lt;&lt; 0));
  (gdb) up
  #4  0x00007fffedc533d1 in SkPixmap::writable_addr8 (this=0x7fffffffc0a8, x=0, y=0) at Skia/Headers/top/skia/core/SkPixmap.h:509
  509             return const_cast&lt;uint8_t*&gt;(this-&gt;addr8(x, y));
  (gdb) up
  #5  0x00007fffedc5328e in WebKit::skiaImageToCairoSurface (image=...) at /sdk/webkit/Source/WebKit/UIProcess/gtk/GtkUtilities.cpp:178                                                                                                          
  178         RefPtr&lt;cairo_surface_t&gt; surface = adoptRef(cairo_image_surface_create_for_data(pixmap.writable_addr8(0, 0), CAIRO_FORMAT_ARGB32, pixmap.width(), pixmap.height(), pixmap.rowBytes()));

Preparing a patch now...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195258</commentid>
    <comment_count>3</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2026-03-30 13:23:06 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/61713</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195263</commentid>
    <comment_count>4</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2026-03-30 13:28:53 -0700</bug_when>
    <thetext>*** Bug 282380 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195316</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-03-30 15:44:13 -0700</bug_when>
    <thetext>Committed 310261@main (a6bf9f89d0b3): &lt;https://commits.webkit.org/310261@main&gt;

Reviewed commits have been landed. Closing PR #61713 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>