<?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>56201</bug_id>
          
          <creation_ts>2011-03-11 09:17:11 -0800</creation_ts>
          <short_desc>WebKitIconDatabase may trigger crash in cairoImageSurfaceToGdkPixbuf</short_desc>
          <delta_ts>2011-03-21 10:11:40 -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>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Christian Dywan">christian</reporter>
          <assigned_to name="Christian Dywan">christian</assigned_to>
          <cc>svillar</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>366038</commentid>
    <comment_count>0</comment_count>
    <who name="Christian Dywan">christian</who>
    <bug_when>2011-03-11 09:17:11 -0800</bug_when>
    <thetext>So I didn&apos;t encounter problem this whilst I was hacking on the feature and once I started to use a patched Midori which exclusively fetches icons from the database I ran into this bug.

Apparently it happens after I close and re-open the browser OR if I open particular websites:

606	    if (! _cairo_surface_is_image (surface)) {
(gdb) bt
#0  0x00007ffff6212e8b in *INT_cairo_image_surface_get_height (surface=0x0) at cairo-image-surface.c:606
#1  0x00007ffff2c8bd86 in cairoImageSurfaceToGdkPixbuf(_cairo_surface*) () from /home/kalikiana/gtk/lib/libwebkitgtk-1.0.so.0
#2  0x00007ffff2ce1916 in webkit_icon_database_get_icon_pixbuf () from /home/kalikiana/gtk/lib/libwebkitgtk-1.0.so.0
#3  0x000000000042adda in katze_load_cached_icon (uri=0xc420e0 &quot;http://www.nekobento.com/&quot;, widget=0xaa2af0) at ../katze/katze-utils.c:1525
#4  0x000000000045f34d in katze_array_action_icon_loaded_cb (database=&lt;value optimized out&gt;, web_frame=&lt;value optimized out&gt;, 
    frame_uri=0xc420e0 &quot;http://www.nekobento.com/&quot;, toolbutton=0xaa18b0) at ../katze/katze-arrayaction.c:669
#5  0x00007ffff5895d3e in g_closure_invoke (closure=0xaa6340, return_value=0x0, n_param_values=3, param_values=0xbf3990, invocation_hint=0x7fffffffca30) at gclosure.c:767
#6  0x00007ffff58a86aa in signal_emit_unlocked_R (node=&lt;value optimized out&gt;, detail=0, instance=0x705580, emission_return=0x0, instance_and_params=0xbf3990)
    at gsignal.c:3252
#7  0x00007ffff58b1cea in g_signal_emit_valist (instance=&lt;value optimized out&gt;, signal_id=&lt;value optimized out&gt;, detail=&lt;value optimized out&gt;, var_args=0x7fffffffcc50)
    at gsignal.c:2983
#8  0x00007ffff58b2052 in g_signal_emit_by_name (instance=&lt;value optimized out&gt;, detailed_signal=0x7ffff3ad252d &quot;icon-loaded&quot;) at gsignal.c:3077
#9  0x00007ffff2cd4b39 in WebKit::FrameLoaderClient::dispatchDidReceiveIcon() () from /home/kalikiana/gtk/lib/libwebkitgtk-1.0.so.0
#10 0x00007ffff31983d8 in WebCore::IconLoader::finishLoading(WebCore::KURL const&amp;, WTF::PassRefPtr&lt;WebCore::SharedBuffer&gt;) ()
   from /home/kalikiana/gtk/lib/libwebkitgtk-1.0.so.0
#11 0x00007ffff31987bb in WebCore::IconLoader::didReceiveResponse(WebCore::SubresourceLoader*, WebCore::ResourceResponse const&amp;) ()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>366072</commentid>
    <comment_count>1</comment_count>
      <attachid>85487</attachid>
    <who name="Christian Dywan">christian</who>
    <bug_when>2011-03-11 10:07:11 -0800</bug_when>
    <thetext>Created attachment 85487
Don&apos;t attempt to make a pixbuf if there is no image</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>367552</commentid>
    <comment_count>2</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2011-03-15 01:13:17 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Created an attachment (id=85487) [details]
&gt; Don&apos;t attempt to make a pixbuf if there is no image

BTW I got the same with a ephy patched version</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>367680</commentid>
    <comment_count>3</comment_count>
      <attachid>85487</attachid>
    <who name="Martin Robinson">mrobinson</who>
    <bug_when>2011-03-15 08:49:49 -0700</bug_when>
    <thetext>Comment on attachment 85487
Don&apos;t attempt to make a pixbuf if there is no image

View in context: https://bugs.webkit.org/attachment.cgi?id=85487&amp;action=review

Looks good. Does  this fix the crasher or are there more?

&gt; Source/WebCore/platform/graphics/gtk/ImageGtk.cpp:157
&gt; +    if (!frameAtIndex(currentFrame()))
&gt; +        return 0;
&gt;      return cairoImageSurfaceToGdkPixbuf(frameAtIndex(currentFrame()));

Please make this simple change before landing.

cairo_surface_t* frame = frameAtIndex(currentFrame());
if (!frame)
    return 0;
return cairoImageSurfaceToGdkPixbuf(frame);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>370440</commentid>
    <comment_count>4</comment_count>
    <who name="Christian Dywan">christian</who>
    <bug_when>2011-03-21 10:11:40 -0700</bug_when>
    <thetext>Committed with the changes as r81589.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>85487</attachid>
            <date>2011-03-11 10:07:11 -0800</date>
            <delta_ts>2011-03-15 08:49:48 -0700</delta_ts>
            <desc>Don&apos;t attempt to make a pixbuf if there is no image</desc>
            <filename>0001-WebKitIconDatabase-may-trigger-crash-in-cairoImageSur.diff</filename>
            <type>text/plain</type>
            <size>1560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5kZXgoY3VycmVudEZyYW1lKCkp
KTsKIH0KIAotLSAKMS43LjQuMQoK
</data>
<flag name="review"
          id="77620"
          type_id="1"
          status="+"
          setter="mrobinson"
    />
          </attachment>
      

    </bug>

</bugzilla>