<?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>43369</bug_id>
          
          <creation_ts>2010-08-02 11:20:36 -0700</creation_ts>
          <short_desc>WebBackForwardList::forwardListAsImmutableArrayWithLimit can return partly-uninitialized array</short_desc>
          <delta_ts>2010-08-02 11:41:45 -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>WebKit2</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>P1</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="John Sullivan">sullivan</reporter>
          <assigned_to name="John Sullivan">sullivan</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>259001</commentid>
    <comment_count>0</comment_count>
    <who name="John Sullivan">sullivan</who>
    <bug_when>2010-08-02 11:20:36 -0700</bug_when>
    <thetext>WebBackForwardList::forwardListAsImmutableArrayWithLimit() has incorrect math that can result in it returning an array that is only partly (or not at all) filled in.

The offending line is this one:

unsigned last = std::min(m_current + limit, static_cast&lt;unsigned&gt;(m_entries.size() - 1));

if m_current + limit is larger than numeric_limits&lt;unsigned&gt;::max(), this expression will return the wrong value, and the subsequent for loop can skip filling in data for some array slots.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>259005</commentid>
    <comment_count>1</comment_count>
      <attachid>63242</attachid>
    <who name="John Sullivan">sullivan</who>
    <bug_when>2010-08-02 11:23:24 -0700</bug_when>
    <thetext>Created attachment 63242
Compute &quot;last&quot; a simpler way that doesn&apos;t have overflow potential.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>259014</commentid>
    <comment_count>2</comment_count>
    <who name="John Sullivan">sullivan</who>
    <bug_when>2010-08-02 11:41:45 -0700</bug_when>
    <thetext>Fixed in http://trac.webkit.org/changeset/64480</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>63242</attachid>
            <date>2010-08-02 11:23:24 -0700</date>
            <delta_ts>2010-08-02 11:28:20 -0700</delta_ts>
            <desc>Compute &quot;last&quot; a simpler way that doesn&apos;t have overflow potential.</desc>
            <filename>43369_patch.txt</filename>
            <type>text/plain</type>
            <size>1413</size>
            <attacher name="John Sullivan">sullivan</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdDIvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYktpdDIvQ2hhbmdlTG9n
CShyZXZpc2lvbiA2NDQ3OCkKKysrIFdlYktpdDIvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTQgQEAKKzIwMTAtMDgtMDIgIEpvaG4gU3VsbGl2YW4gIDxzdWxsaXZhbkBhcHBs
ZS5jb20+CisKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lk
PTQzMzY5CisgICAgICAgIFdlYkJhY2tGb3J3YXJkTGlzdDo6Zm9yd2FyZExpc3RBc0ltbXV0YWJs
ZUFycmF5V2l0aExpbWl0IGNhbiByZXR1cm4gcGFydGx5LXVuaW5pdGlhbGl6ZWQgYXJyYXkKKyAg
ICAgICAgCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09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QgbGFz
dCA9IG1fY3VycmVudCArIHNpemU7CiAgICAgZm9yICh1bnNpZ25lZCBpID0gbV9jdXJyZW50ICsg
MSwgaiA9IDA7IGkgPD0gbGFzdDsgKytpLCArK2opIHsKICAgICAgICAgQVBJT2JqZWN0KiBpdGVt
ID0gbV9lbnRyaWVzW2ldLmdldCgpOwogICAgICAgICBpdGVtLT5yZWYoKTsK
</data>
<flag name="review"
          id="51552"
          type_id="1"
          status="+"
          setter="adachan"
    />
          </attachment>
      

    </bug>

</bugzilla>