<?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>30122</bug_id>
          
          <creation_ts>2009-10-06 05:52:24 -0700</creation_ts>
          <short_desc>Geolocation does not protect against wrap-around of request IDs</short_desc>
          <delta_ts>2009-10-28 12:23:51 -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>
          <dependson>29178</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Steve Block">steveblock</reporter>
          <assigned_to name="Steve Block">steveblock</assigned_to>
          <cc>bolsinga</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>eric</cc>
    
    <cc>steveblock</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>152689</commentid>
    <comment_count>0</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2009-10-06 05:52:24 -0700</bug_when>
    <thetext>Currently there is no guard to prevent wrap-around of the IDs used for Geolocation requests. This means that when the ID overflows, a previously existing request will be canceled and its ID reused. The orignal ID will then reference the wrong request.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>152788</commentid>
    <comment_count>1</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2009-10-06 10:49:55 -0700</bug_when>
    <thetext>I looked at how window.setTimeout() handles overflow of its timer IDs. It looks like it simply allows the overflow to happen (while ensuring the ID remains positive), thus overwriting the previous timer. See http://trac.webkit.org/browser/trunk/WebCore/page/DOMTimer.cpp.

I suggest we do the same for Geolocation requests - allow the overflow, making sure the ID remains positive or negative as appropriate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158636</commentid>
    <comment_count>2</comment_count>
      <attachid>42043</attachid>
    <who name="Steve Block">steveblock</who>
    <bug_when>2009-10-28 10:46:24 -0700</bug_when>
    <thetext>Created attachment 42043
Patch 1 for Bug 30122

It&apos;s not practical to add a test for this, as triggering the overflow would require so many watches to be started that it would be prohibitively slow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158638</commentid>
    <comment_count>3</comment_count>
      <attachid>42043</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-10-28 10:49:29 -0700</bug_when>
    <thetext>Comment on attachment 42043
Patch 1 for Bug 30122

r=me

If you want to be pedantic, overflow has defined behavior for unsigned but not for int. So it&apos;s best to code this sort of thing so it detects overflow before it happens or use unsigned. But that&apos;s not a realistic concern.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158657</commentid>
    <comment_count>4</comment_count>
      <attachid>42043</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2009-10-28 12:23:46 -0700</bug_when>
    <thetext>Comment on attachment 42043
Patch 1 for Bug 30122

Clearing flags on attachment: 42043

Committed r50229: &lt;http://trac.webkit.org/changeset/50229&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158658</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2009-10-28 12:23:51 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>42043</attachid>
            <date>2009-10-28 10:46:24 -0700</date>
            <delta_ts>2009-10-28 12:23:46 -0700</delta_ts>
            <desc>Patch 1 for Bug 30122</desc>
            <filename>handleWatchIdOverflow.txt</filename>
            <type>text/plain</type>
            <size>1290</size>
            <attacher name="Steve Block">steveblock</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1MDIyMykKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTUgQEAKKzIwMDktMTAtMjggIFN0ZXZlIEJsb2NrICA8c3RldmVibG9ja0Bnb29n
bGUuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAg
IE1ha2VzIHN1cmUgdGhhdCBHZW9sb2NhdGlvbiB3YXRjaCBJRHMgcmVtYWluIHBvc2l0aXZlIG9u
IG92ZXJmbG93LgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/
aWQ9MzAxMjIKKworICAgICAgICBObyBuZXcgdGVzdHMgcG9zc2libGUuCisKKyAgICAgICAgKiBw
YWdlL0dlb2xvY2F0aW9uLmNwcDogTW9kaWZpZWQuCisgICAgICAgIChXZWJDb3JlOjpHZW9sb2Nh
dGlvbjo6d2F0Y2hQb3NpdGlvbik6IE1vZGlmaWVkLiBSZXNldCB0aGUgd2F0Y2ggSUQgdG8gMSBv
biBvdmVyZmxvdy4KKwogMjAwOS0xMC0yOCAgUGF2ZWwgRmVsZG1hbiAgPHBmZWxkbWFuQGNocm9t
aXVtLm9yZz4KIAogICAgICAgICBOb3QgcmV2aWV3ZWQ6IGZvbGxvdyB1cCBmaXggdG8gSW5zcGVj
dG9yQ29udHJvbGxlclN0dWIuCkluZGV4OiBXZWJDb3JlL3BhZ2UvR2VvbG9jYXRpb24uY3BwCj09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT0KLS0tIFdlYkNvcmUvcGFnZS9HZW9sb2NhdGlvbi5jcHAJKHJldmlzaW9uIDUwMjEz
KQorKysgV2ViQ29yZS9wYWdlL0dlb2xvY2F0aW9uLmNwcAkod29ya2luZyBjb3B5KQpAQCAtMTY0
LDYgKzE2NCw5IEBAIGludCBHZW9sb2NhdGlvbjo6d2F0Y2hQb3NpdGlvbihQYXNzUmVmUHQKICAg
ICAgICAgcmV0dXJuIDA7CiAKICAgICBzdGF0aWMgaW50IG5leHRBdmFpbGFibGVXYXRjaElkID0g
MTsKKyAgICAvLyBJbiBjYXNlIG9mIG92ZXJmbG93LCBtYWtlIHN1cmUgdGhlIElEIHJlbWFpbnMg
cG9zaXRpdmUsIGJ1dCByZXVzZSB0aGUgSUQgdmFsdWVzLgorICAgIGlmIChuZXh0QXZhaWxhYmxl
V2F0Y2hJZCA8IDEpCisgICAgICAgIG5leHRBdmFpbGFibGVXYXRjaElkID0gMTsKICAgICBtX3dh
dGNoZXJzLnNldChuZXh0QXZhaWxhYmxlV2F0Y2hJZCwgbm90aWZpZXIucmVsZWFzZSgpKTsKICAg
ICByZXR1cm4gbmV4dEF2YWlsYWJsZVdhdGNoSWQrKzsKIH0K
</data>

          </attachment>
      

    </bug>

</bugzilla>