<?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>31138</bug_id>
          
          <creation_ts>2009-11-04 12:17:36 -0800</creation_ts>
          <short_desc>Uninitialized memory read in WebCore::Page::userStyleSheetLocationChanged()</short_desc>
          <delta_ts>2009-11-04 22:39:55 -0800</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>PC</rep_platform>
          <op_sys>OS X 10.5</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="Dan Kegel">dank</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>160558</commentid>
    <comment_count>0</comment_count>
    <who name="Dan Kegel">dank</who>
    <bug_when>2009-11-04 12:17:36 -0800</bug_when>
    <thetext>Found via chromium linux layout valgrind bot on
LayoutTests/platform/mac/fast/loader/user-stylesheet-fast-path.html .
Valgrind complains

Invalid read of size 1
   at strlen (mc_replace_strmem.c:275)
   by WebCore::String::fromUTF8(char const*) (String.cpp:682)
   by WebCore::Page::userStyleSheetLocationChanged() (Page.cpp:545)
 Address 0xd60f4af is 0 bytes after a block of size 31 alloc&apos;d
   at malloc (vg_replace_malloc.c:195)
   ...
   by WebCore::base64Decode(WTF::Vector&lt;char, 0ul&gt; const&amp;, WTF::Vector&lt;char, 0ul&gt;&amp;) (Base64.cpp:134)
   by WebCore::Page::userStyleSheetLocationChanged() (Page.cpp:544)

Looks like someone forgot to specify a length.  I&apos;ll attach a fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160565</commentid>
    <comment_count>1</comment_count>
      <attachid>42510</attachid>
    <who name="Dan Kegel">dank</who>
    <bug_when>2009-11-04 12:22:48 -0800</bug_when>
    <thetext>Created attachment 42510
Supply missing length argument to avoid buffer overrun

le voilà!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160640</commentid>
    <comment_count>2</comment_count>
      <attachid>42510</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-11-04 15:57:34 -0800</bug_when>
    <thetext>Comment on attachment 42510
Supply missing length argument to avoid buffer overrun

+        * page/Page.cpp:
+        (WebCore::Page::userStyleSheetLocationChanged):

Ideally, there should be per-function comments explaining changes.

r=me as is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160726</commentid>
    <comment_count>3</comment_count>
      <attachid>42510</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-11-04 22:14:52 -0800</bug_when>
    <thetext>Comment on attachment 42510
Supply missing length argument to avoid buffer overrun

I wonder if there are other places we call from UTF8 and need fixes? Since dan&apos;s not a committer, adding this to the cq.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160732</commentid>
    <comment_count>4</comment_count>
      <attachid>42510</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2009-11-04 22:39:51 -0800</bug_when>
    <thetext>Comment on attachment 42510
Supply missing length argument to avoid buffer overrun

Clearing flags on attachment: 42510

Committed r50545: &lt;http://trac.webkit.org/changeset/50545&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160733</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2009-11-04 22:39:55 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>42510</attachid>
            <date>2009-11-04 12:22:48 -0800</date>
            <delta_ts>2009-11-04 22:39:51 -0800</delta_ts>
            <desc>Supply missing length argument to avoid buffer overrun</desc>
            <filename>webkit31138.patch</filename>
            <type>text/plain</type>
            <size>1290</size>
            <attacher name="Dan Kegel">dank</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1MDUyNCkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTUgQEAKKzIwMDktMTEtMDQgIERhbiBLZWdlbCAgPGRhbmtAY2hyb21pdW0ub3Jn
PgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIEZpeCBi
dWZmZXIgb3ZlcnJ1biBpbiBXZWJDb3JlOjpQYWdlOjp1c2VyU3R5bGVTaGVldExvY2F0aW9uQ2hh
bmdlZCgpCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0z
MTEzOAorCisgICAgICAgIFRlc3Q6IExheW91dFRlc3RzL3BsYXRmb3JtL21hYy9mYXN0L2xvYWRl
ci91c2VyLXN0eWxlc2hlZXQtZmFzdC1wYXRoLmh0bWwgaW4gVmFsZ3JpbmQKKworICAgICAgICAq
IHBhZ2UvUGFnZS5jcHA6CisgICAgICAgIChXZWJDb3JlOjpQYWdlOjp1c2VyU3R5bGVTaGVldExv
Y2F0aW9uQ2hhbmdlZCk6CisKIDIwMDktMTEtMDQgIEtlbGx5IE5vcnRvbiAgPGtub3J0b25AZ29v
Z2xlLmNvbT4KIAogICAgICAgICBSZXZpZXdlZCBieSBQYXZlbCBGZWxkbWFuLgpJbmRleDogV2Vi
Q29yZS9wYWdlL1BhZ2UuY3BwCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvcGFnZS9QYWdlLmNwcAko
cmV2aXNpb24gNTA1MTEpCisrKyBXZWJDb3JlL3BhZ2UvUGFnZS5jcHAJKHdvcmtpbmcgY29weSkK
QEAgLTU0Miw3ICs1NDIsNyBAQCB2b2lkIFBhZ2U6OnVzZXJTdHlsZVNoZWV0TG9jYXRpb25DaGFu
Z2VkCiAKICAgICAgICAgVmVjdG9yPGNoYXI+IHN0eWxlU2hlZXRBc1VURjg7CiAgICAgICAgIGlm
IChiYXNlNjREZWNvZGUoZW5jb2RlZERhdGEsIHN0eWxlU2hlZXRBc1VURjgpKQotICAgICAgICAg
ICAgbV91c2VyU3R5bGVTaGVldCA9IFN0cmluZzo6ZnJvbVVURjgoc3R5bGVTaGVldEFzVVRGOC5k
YXRhKCkpOworICAgICAgICAgICAgbV91c2VyU3R5bGVTaGVldCA9IFN0cmluZzo6ZnJvbVVURjgo
c3R5bGVTaGVldEFzVVRGOC5kYXRhKCksIHN0eWxlU2hlZXRBc1VURjguc2l6ZSgpKTsKICAgICB9
CiAgICAgCiAgICAgZm9yIChGcmFtZSogZnJhbWUgPSBtYWluRnJhbWUoKTsgZnJhbWU7IGZyYW1l
ID0gZnJhbWUtPnRyZWUoKS0+dHJhdmVyc2VOZXh0KCkpIHsK
</data>

          </attachment>
      

    </bug>

</bugzilla>