<?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>67469</bug_id>
          
          <creation_ts>2011-09-02 01:20:34 -0700</creation_ts>
          <short_desc>[WinCairo] IconDatabase::defaultIcon always fails for non-CAN_THEME_URL_ICON builds.</short_desc>
          <delta_ts>2011-09-21 10:09:55 -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>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</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>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="David Delaune">david.delaune</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>bfulgham</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>461089</commentid>
    <comment_count>0</comment_count>
    <who name="David Delaune">david.delaune</who>
    <bug_when>2011-09-02 01:20:34 -0700</bug_when>
    <thetext>Hi,

I encountered an access violation inside WebKit.dll while implementing favicons. In a nutshell... The loadDefaultIconRecord returns a big-endian TIFF in a static buffer. The ImageDecoder::create is checking the first 14 bytes of the image in order to return the correct ImageDecoder class. The problem is that ImageDecoder::create never even checks for a TIFF header and returns a NULL ImageDecoder* which causes ImageSource::setData to fail.

The end-result is an access violation at this line in WebIconDatabase.cpp when attempting to get the default icon.

&gt; if (!iconDatabase().defaultIcon(*size)-&gt;getHBITMAPOfSize(result, size)) {

This call stack shows all of the functions involved:

WebKit.dll!WebCore::ImageDecoder::create(const WebCore::SharedBuffer &amp; data={...}, WebCore::ImageSource::AlphaOption alphaOption=AlphaPremultiplied, WebCore::ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption=GammaAndColorProfileApplied)  Line 105	C++
WebKit.dll!WebCore::ImageSource::setData(WebCore::SharedBuffer * data=0x7ef30258, bool allDataReceived=true)  Line 82 + 0xe bytes	C++
WebKit.dll!WebCore::BitmapImage::dataChanged(bool allDataReceived=true)  Line 213	C++
WebKit.dll!WebCore::Image::setData(WTF::PassRefPtr&lt;WebCore::SharedBuffer&gt; data={...}, bool allDataReceived=true)  Line 77 + 0xe bytes	C++
WebKit.dll!WebCore::IconRecord::setImageData(WTF::PassRefPtr&lt;WebCore::SharedBuffer&gt; data={...})  Line 72 + 0x19 bytes	C++
WebKit.dll!WebCore::loadDefaultIconRecord(WebCore::IconRecord * defaultIconRecord=0x7eedbc00)  Line 375	C++
WebKit.dll!WebCore::IconDatabase::defaultIcon(const WebCore::IntSize &amp; size={...})  Line 386 + 0x9 bytes	C++
WebKit.dll!WebIconDatabase::getOrCreateDefaultIconBitmap(tagSIZE * size=0x90050d8c)  Line 313 + 0x1b bytes	C++
WebKit.dll!WebIconDatabase::defaultIconWithSize(tagSIZE * size=0x0018f6b4, unsigned int * result=0x0018f6c4)  Line 194 + 0xc bytes	C++
WebKit.dll!WebIconDatabase::iconForURL(wchar_t * url=0x7ee99000, tagSIZE * size=0x0018f6b4, int __formal=1, unsigned int * bitmap=0x0018f6c4)  Line 187 + 0x13 bytes	C++
[...]

Note: The above call stack is before the access violation has occured. The access violation will occur in WebIconDatabase::getOrCreateDefaultIconBitmap due to the NULL Image* pointer. Ports such as QT and GTK might not experience this bug because CAN_THEME_URL_ICON is defined which causes the default icon to be loaded from resource.

Best Wishes,
-David Delaune</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>467350</commentid>
    <comment_count>1</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2011-09-14 14:41:36 -0700</bug_when>
    <thetext>You encountered this with the mainline Apple port of WebKit on Windows?  You encountered this within Safari for Windows?

If the answer to either of these questions is &quot;No&quot;, I&apos;d need more info to diagnose what you&apos;re running into.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>467387</commentid>
    <comment_count>2</comment_count>
    <who name="David Delaune">david.delaune</who>
    <bug_when>2011-09-14 15:11:15 -0700</bug_when>
    <thetext>I am developing with the WinCairo branch but this should have zero effect on the outcome. If you look closely at the code path starting at getOrCreateDefaultIconBitmap you should discover that it is impossible for this function to succeed unless CAN_THEME_URL_ICON is defined.

loadDefaultIconRecord() returns a TIFF hard-coded into a static buffer. Following the code path you should find that ImageDecoder::create never checks for a TIFF header and will always result in a NULL ImageDecoder* pointer.

Would you like me to modify WinLauncher so that it reveals the access violation? All that you need to do is instantiate an instance of IWebIconDatabase and call iconForURL for any domain without a favicon.

Best Wishes,
-David Delaune</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>467403</commentid>
    <comment_count>3</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2011-09-14 15:25:33 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; I am developing with the WinCairo branch but this should have zero effect on the outcome. If you look closely at the code path starting at getOrCreateDefaultIconBitmap you should discover that it is impossible for this function to succeed unless CAN_THEME_URL_ICON is defined.

Then this will only work for CAN_THEME_URL_ICON builds.  :)

&gt; Would you like me to modify WinLauncher so that it reveals the access violation? All that you need to do is instantiate an instance of IWebIconDatabase and call iconForURL for any domain without a favicon.

We don&apos;t use WinLauncher extensively, if at all.  


&gt; 
&gt; Best Wishes,
&gt; -David Delaune</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>467427</commentid>
    <comment_count>4</comment_count>
      <attachid>107412</attachid>
    <who name="David Delaune">david.delaune</who>
    <bug_when>2011-09-14 15:42:19 -0700</bug_when>
    <thetext>Created attachment 107412
WinCairo wants CAN_THEME_URL_ICON

WinCairo wants CAN_THEME_URL_ICON</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>467442</commentid>
    <comment_count>5</comment_count>
    <who name="David Delaune">david.delaune</who>
    <bug_when>2011-09-14 15:53:55 -0700</bug_when>
    <thetext>Do you think that perhaps it would be better if I close this as RESOLVED and open a more specific WinCairo bug/feature request?

Best Wishes,
-David Delaune</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>468627</commentid>
    <comment_count>6</comment_count>
      <attachid>107412</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2011-09-16 11:11:44 -0700</bug_when>
    <thetext>Comment on attachment 107412
WinCairo wants CAN_THEME_URL_ICON

This looks good to me.  Let&apos;s let the EWS system chew on it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>468661</commentid>
    <comment_count>7</comment_count>
    <who name="David Delaune">david.delaune</who>
    <bug_when>2011-09-16 11:34:15 -0700</bug_when>
    <thetext>*** Bug 68261 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>468684</commentid>
    <comment_count>8</comment_count>
      <attachid>107412</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2011-09-16 11:58:06 -0700</bug_when>
    <thetext>Comment on attachment 107412
WinCairo wants CAN_THEME_URL_ICON

Overall, the change looks good.  However, it is missing a ChangeLog entry that explains the change, who made the change, and provides a link to the bugzilla entry.

Please revise the patch to include the ChangeLog (see the http://www.webkit.org/coding/contributing.html page for details).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>469094</commentid>
    <comment_count>9</comment_count>
      <attachid>107772</attachid>
    <who name="David Delaune">david.delaune</who>
    <bug_when>2011-09-17 13:12:24 -0700</bug_when>
    <thetext>Created attachment 107772
Changelog added to patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>469218</commentid>
    <comment_count>10</comment_count>
      <attachid>107772</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2011-09-18 20:05:43 -0700</bug_when>
    <thetext>Comment on attachment 107772
Changelog added to patch

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

Looks great!

&gt; Source/WebCore/ChangeLog:8
&gt; +        No new tests. (OOPS!)

Please remove this line, or say &quot;No new functionality added in this change.&quot;

&gt; Source/WebCore/ChangeLog:10
&gt; +        * loader/icon/IconDatabase.cpp:

Could you just mention here that you are defining CAN_THEME_URL_ICON for the WIN_CAIRO case?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>470495</commentid>
    <comment_count>11</comment_count>
      <attachid>108084</attachid>
    <who name="David Delaune">david.delaune</who>
    <bug_when>2011-09-20 17:17:58 -0700</bug_when>
    <thetext>Created attachment 108084
Updated patch comments</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>470885</commentid>
    <comment_count>12</comment_count>
      <attachid>108084</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2011-09-21 09:57:12 -0700</bug_when>
    <thetext>Comment on attachment 108084
Updated patch comments

Looks good to me!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>470900</commentid>
    <comment_count>13</comment_count>
      <attachid>108084</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-09-21 10:09:50 -0700</bug_when>
    <thetext>Comment on attachment 108084
Updated patch comments

Clearing flags on attachment: 108084

Committed r95646: &lt;http://trac.webkit.org/changeset/95646&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>470901</commentid>
    <comment_count>14</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-09-21 10:09:55 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>107412</attachid>
            <date>2011-09-14 15:42:19 -0700</date>
            <delta_ts>2011-09-17 13:12:24 -0700</delta_ts>
            <desc>WinCairo wants CAN_THEME_URL_ICON</desc>
            <filename>patch.diff</filename>
            <type>text/plain</type>
            <size>932</size>
            <attacher name="David Delaune">david.delaune</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL2xvYWRlci9pY29uL0ljb25EYXRhYmFzZS5jcHAKPT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PQotLS0gU291cmNlL1dlYkNvcmUvbG9hZGVyL2ljb24vSWNvbkRhdGFiYXNlLmNwcAkocmV2
aXNpb24gOTQ0NzYpCisrKyBTb3VyY2UvV2ViQ29yZS9sb2FkZXIvaWNvbi9JY29uRGF0YWJhc2Uu
Y3BwCSh3b3JraW5nIGNvcHkpCkBAIC0yMSw3ICsyMSw3IEBACiAgKiBQUk9GSVRTOyBPUiBCVVNJ
TkVTUyBJTlRFUlJVUFRJT04pIEhPV0VWRVIgQ0FVU0VEIEFORCBPTiBBTlkgVEhFT1JZCiAgKiBP
RiBMSUFCSUxJVFksIFdIRVRIRVIgSU4gQ09OVFJBQ1QsIFNUUklDVCBMSUFCSUxJVFksIE9SIFRP
UlQKICAqIChJTkNMVURJTkcgTkVHTElHRU5DRSBPUiBPVEhFUldJU0UpIEFSSVNJTkcgSU4gQU5Z
IFdBWSBPVVQgT0YgVEhFIFVTRQotICogT0YgVEhJUyBTT0ZUV0FSRSwgRVZFTiBJRiBBRFZJU0VE
IE9GIFRIRSBQT1NTSUJJTElUWSBPRiBTVUNIIERBTUFHRS4gCisgKiBPRiBUSElTIFNPRlRXQVJF
LCBFVkVOIElGIEFEVklTRUQgT0YgVEhFIFBPU1NJQklMSVRZIE9GIFNVQ0ggREFNQUdFLgogICov
CiAKICNpbmNsdWRlICJjb25maWcuaCIKQEAgLTUxLDcgKzUxLDcgQEAKICNkZWZpbmUgSVNfSUNP
Tl9TWU5DX1RIUkVBRCgpIChtX3N5bmNUaHJlYWQgPT0gY3VycmVudFRocmVhZCgpKQogI2RlZmlu
ZSBBU1NFUlRfSUNPTl9TWU5DX1RIUkVBRCgpIEFTU0VSVChJU19JQ09OX1NZTkNfVEhSRUFEKCkp
CiAKLSNpZiBQTEFURk9STShRVCkgfHwgUExBVEZPUk0oR1RLKQorI2lmIFBMQVRGT1JNKFFUKSB8
fCBQTEFURk9STShHVEspIHx8IFBMQVRGT1JNKFdJTl9DQUlSTykKICNkZWZpbmUgQ0FOX1RIRU1F
X1VSTF9JQ09OCiAjZW5kaWYKIAo=
</data>
<flag name="review"
          id="104436"
          type_id="1"
          status="-"
          setter="bfulgham"
    />
          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>107772</attachid>
            <date>2011-09-17 13:12:24 -0700</date>
            <delta_ts>2011-09-20 17:17:58 -0700</delta_ts>
            <desc>Changelog added to patch</desc>
            <filename>patch.diff</filename>
            <type>text/plain</type>
            <size>1222</size>
            <attacher name="David Delaune">david.delaune</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDk1MzgzKQorKysgU291cmNlL1dlYkNvcmUvQ2hhbmdl
TG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTQgQEAKKzIwMTEtMDktMTcgIERhdmlkIERl
bGF1bmUgIDxkYXZpZC5kZWxhdW5lQGdvb2dsZW1haWwuY29tPgorCisgICAgICAgIFtXaW5DYWly
b10gSWNvbkRhdGFiYXNlOjpkZWZhdWx0SWNvbiBhbHdheXMgZmFpbHMgZm9yIG5vbi1DQU5fVEhF
TUVfVVJMX0lDT04gYnVpbGRzLgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93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ogCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>108084</attachid>
            <date>2011-09-20 17:17:58 -0700</date>
            <delta_ts>2011-09-21 10:09:50 -0700</delta_ts>
            <desc>Updated patch comments</desc>
            <filename>patch.diff</filename>
            <type>text/plain</type>
            <size>1289</size>
            <attacher name="David Delaune">david.delaune</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDk1MzgzKQorKysgU291cmNlL1dlYkNvcmUvQ2hhbmdl
TG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTQgQEAKKzIwMTEtMDktMTcgIERhdmlkIERl
bGF1bmUgIDxkYXZpZC5kZWxhdW5lQGdvb2dsZW1haWwuY29tPgorCisgICAgICAgIFtXaW5DYWly
b10gSWNvbkRhdGFiYXNlOjpkZWZhdWx0SWNvbiBhbHdheXMgZmFpbHMgZm9yIG5vbi1DQU5fVEhF
TUVfVVJMX0lDT04gYnVpbGRzLgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93
X2J1Zy5jZ2k/aWQ9Njc0NjkKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4K
KworICAgICAgICBObyBuZXcgZnVuY3Rpb25hbGl0eSBhZGRlZCBpbiB0aGlzIGNoYW5nZS4KKwor
ICAgICAgICAqIGxvYWRlci9pY29uL0ljb25EYXRhYmFzZS5jcHA6IGRlZmluaW5nIENBTl9USEVN
RV9VUkxfSUNPTiBmb3IgdGhlIFdJTl9DQUlSTworCiAyMDExLTA5LTE3ICBJbHlhIFRpa2hvbm92
c2t5ICA8bG9pc2xvQGNocm9taXVtLm9yZz4KIAogICAgICAgICBXZWIgSW5zcGVjdG9yOiBmaWxl
IG9wZW4gZGlhbG9nIGFwcGVhcnMgd2hlbiB1c2VyIGNsaWNrcyBvbiB0aGUgdGltZWxpbmUgYmFy
IGluIHRpbWVsaW5lIHBhbmVsLgpJbmRleDogU291cmNlL1dlYkNvcmUvbG9hZGVyL2ljb24vSWNv
bkRhdGFiYXNlLmNwcAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2ViQ29yZS9sb2FkZXIvaWNvbi9J
Y29uRGF0YWJhc2UuY3BwCShyZXZpc2lvbiA5NDQ3NikKKysrIFNvdXJjZS9XZWJDb3JlL2xvYWRl
ci9pY29uL0ljb25EYXRhYmFzZS5jcHAJKHdvcmtpbmcgY29weSkKQEAgLTUxLDcgKzUxLDcgQEAK
ICNkZWZpbmUgSVNfSUNPTl9TWU5DX1RIUkVBRCgpIChtX3N5bmNUaHJlYWQgPT0gY3VycmVudFRo
cmVhZCgpKQogI2RlZmluZSBBU1NFUlRfSUNPTl9TWU5DX1RIUkVBRCgpIEFTU0VSVChJU19JQ09O
X1NZTkNfVEhSRUFEKCkpCiAKLSNpZiBQTEFURk9STShRVCkgfHwgUExBVEZPUk0oR1RLKQorI2lm
IFBMQVRGT1JNKFFUKSB8fCBQTEFURk9STShHVEspIHx8IFBMQVRGT1JNKFdJTl9DQUlSTykKICNk
ZWZpbmUgQ0FOX1RIRU1FX1VSTF9JQ09OCiAjZW5kaWYKIAo=
</data>

          </attachment>
      

    </bug>

</bugzilla>