<?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>159330</bug_id>
          
          <creation_ts>2016-06-30 21:30:16 -0700</creation_ts>
          <short_desc>Possible null Range dereference under AXObjectCache::visiblePositionFromCharacterOffset()</short_desc>
          <delta_ts>2016-07-01 16:25:37 -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>Accessibility</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>158138</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>aboxhall</cc>
    
    <cc>apinheiro</cc>
    
    <cc>cfleizach</cc>
    
    <cc>commit-queue</cc>
    
    <cc>dmazzoni</cc>
    
    <cc>enrica</cc>
    
    <cc>jcraig</cc>
    
    <cc>jdiggs</cc>
    
    <cc>mario</cc>
    
    <cc>n_wang</cc>
    
    <cc>rniwa</cc>
    
    <cc>samuel_white</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1206987</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-06-30 21:30:16 -0700</bug_when>
    <thetext>Possible null Range dereference under AXObjectCache::visiblePositionFromCharacterOffset():
Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000018
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x18:
--&gt; 
    __TEXT                 0000000107708000-000000010770a000 [    8K] r-x/rwx SM=COW  /System/Library/Frameworks/WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.WebContent.xpc/Contents/MacOS/com.apple.WebKit.WebContent

Application Specific Information:
Bundle controller class:
BrowserBundleController
Thread 0 Crashed ↩:: Dispatch queue: com.apple.main-thread
0   com.apple.WebCore             	0x00007fffa724d981 WebCore::Range::startPosition() const + 17
1   com.apple.WebCore             	0x00007fffa7385695 WebCore::AXObjectCache::visiblePositionFromCharacterOffset(WebCore::CharacterOffset const&amp;) + 53
2   com.apple.WebCore             	0x00007fffa738553c WebCore::AXObjectCache::setTextMarkerDataWithCharacterOffset(WebCore::TextMarkerData&amp;, WebCore::CharacterOffset const&amp;) + 140
3   com.apple.WebCore             	0x00007fffa7385f63 WebCore::AXObjectCache::startOrEndTextMarkerDataForRange(WebCore::TextMarkerData&amp;, WTF::RefPtr&lt;WebCore::Range&gt;, bool) + 147
4   com.apple.WebCore             	0x00007fffa810f1e0 startOrEndTextmarkerForRange(WebCore::AXObjectCache*, WTF::RefPtr&lt;WebCore::Range&gt;, bool) + 48
5   com.apple.WebCore             	0x00007fffa810efca -[WebAccessibilityObjectWrapper textMarkerRangeFromRange:] + 154
6   com.apple.WebCore             	0x00007fffa811f5d2 -[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:] + 5794
7   com.apple.AppKit              	0x00007fff9ead94cb ___NSAccessibilityEntryPointValueForAttributeWithParameter_block_invoke.824 + 416</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1206988</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2016-06-30 21:30:45 -0700</bug_when>
    <thetext>&lt;rdar://problem/27123752&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1206989</commentid>
    <comment_count>2</comment_count>
      <attachid>282511</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-06-30 21:34:14 -0700</bug_when>
    <thetext>Created attachment 282511
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1206998</commentid>
    <comment_count>3</comment_count>
      <attachid>282511</attachid>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2016-06-30 23:21:45 -0700</bug_when>
    <thetext>Comment on attachment 282511
Patch

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

Can you please try to write a test before landing?

&gt; Source/WebCore/accessibility/AXObjectCache.cpp:1961
&gt; +    auto range = rangeForUnorderedCharacterOffsets(characterOffset, characterOffset);

Honestly, this auto is making this code worse.
I would prefer if you used the type.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1207270</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-07-01 14:14:51 -0700</bug_when>
    <thetext>+ cfleizach / n_wang in case they know how to write a test for this as I have no idea.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1207292</commentid>
    <comment_count>5</comment_count>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2016-07-01 15:09:27 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; + cfleizach / n_wang in case they know how to write a test for this as I
&gt; have no idea.

There are some existing text marker range tests. My guess is you could make some invalid text marker ranges and pass into the api that calls into this method to recreate</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1207324</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-07-01 16:06:27 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; + cfleizach / n_wang in case they know how to write a test for this as I
&gt; &gt; have no idea.
&gt; 
&gt; There are some existing text marker range tests. My guess is you could make
&gt; some invalid text marker ranges and pass into the api that calls into this
&gt; method to recreate

OK, it looks like I have a test, thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1207325</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-07-01 16:11:47 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #5)
&gt; &gt; (In reply to comment #4)
&gt; &gt; &gt; + cfleizach / n_wang in case they know how to write a test for this as I
&gt; &gt; &gt; have no idea.
&gt; &gt; 
&gt; &gt; There are some existing text marker range tests. My guess is you could make
&gt; &gt; some invalid text marker ranges and pass into the api that calls into this
&gt; &gt; method to recreate
&gt; 
&gt; OK, it looks like I have a test, thanks.

Actually no, the crash was in WKTR code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1207335</commentid>
    <comment_count>8</comment_count>
      <attachid>282511</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-07-01 16:25:31 -0700</bug_when>
    <thetext>Comment on attachment 282511
Patch

Clearing flags on attachment: 282511

Committed r202762: &lt;http://trac.webkit.org/changeset/202762&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1207336</commentid>
    <comment_count>9</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-07-01 16:25:37 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>282511</attachid>
            <date>2016-06-30 21:34:14 -0700</date>
            <delta_ts>2016-07-01 16:25:31 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-159330-20160630213352.patch</filename>
            <type>text/plain</type>
            <size>1906</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjAyNzIzCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2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