<?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>284246</bug_id>
          
          <creation_ts>2024-12-08 06:29:20 -0800</creation_ts>
          <short_desc>AX: Crash in AtspiObject-&gt;textAttributesWithUTF8Offset</short_desc>
          <delta_ts>2025-01-21 08:53:22 -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>Accessibility</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>270354</dup_id>
          
          <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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mike Gorse">mgorse</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andresg_22</cc>
    
    <cc>feaneron</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2079979</commentid>
    <comment_count>0</comment_count>
    <who name="Mike Gorse">mgorse</who>
    <bug_when>2024-12-08 06:29:20 -0800</bug_when>
    <thetext>Steps to reproduce:
1. Enable screen reader. I&apos;m using Orca 47.2; I&apos;m guessing that anything &gt;= 47 will work.
2. Start evolution.
3. Set up a gmail/google account. Start the oauth flow.
4. Press tab a few times to focus the next button.

#3  0x00007f48f662891a in __GI_abort () at abort.c:79
79            raise (SIGABRT);
#4  0x00007f48fdf77454 in WTF::CrashOnOverflow::crash () at /home/mgorse/src/WebKit/t/WTF/Headers/wtf/CheckedArithmetic.h:109
109             CRASH();
#5  0x00007f48fdf7744b in WTF::CrashOnOverflow::overflowed () at /home/mgorse/src/WebKit/t/WTF/Headers/wtf/CheckedArithmetic.h:102
102             crash();
#6  0x00007f490244f82d in WTF::Vector&lt;unsigned int, 128ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::at (this=0x7ffd82b2a0d0, i=4) at /home/mgorse/src/WebKit/t/WTF/Headers/wtf/Vector.h:847
847                 OverflowHandler::overflowed();
#7  0x00007f490244ed23 in WTF::Vector&lt;unsigned int, 128ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::operator[] (this=0x7ffd82b2a0d0, i=4) at /home/mgorse/src/WebKit/t/WTF/Headers/wtf/Vector.h:852
852         const T&amp; operator[](size_t i) const { return at(i);
}
#8  0x00007f4902449323 in WebCore::UTF16OffsetToUTF8 (mapping=WTF::Vector of length 2, capacity 128 = {...}, offset=4) at /home/mgorse/src/WebKit/Source/WebCore/accessibility/atspi/AccessibilityObjectTextAtspi.cp
p:256
256         return mapping.isEmpty() ? offset : mapping[offset];
#9  0x00007f490244e0e6 in WebCore::AccessibilityObjectAtspi::textAttributesWithUTF8Offset (this=0x7f48e9d35080, offset=std::optional = {...}, includeDefault=true)
    at /home/mgorse/src/WebKit/Source/WebCore/accessibility/atspi/AccessibilityObjectTextAtspi.cpp:935
935             attributes.startOffset = UTF16OffsetToUTF8(mapping, attributes.startOffset);
(gdb)
#10 0x00007f490244820a in operator() (__closure=0x0, methodName=0x7f48d4007470 &quot;GetAttributeRun&quot;, parameters=0x7f48d4008310, invocation=0x7f48d40050c0, userData=0x7f48e9d35080)
    at /home/mgorse/src/WebKit/Source/WebCore/accessibility/atspi/AccessibilityObjectTextAtspi.cpp:139
139                 auto attributes = atspiObject-&gt;textAttributesWithUTF8Offset(offset, includeDefaults);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2079980</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-12-08 06:29:28 -0800</bug_when>
    <thetext>&lt;rdar://problem/141119347&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2079981</commentid>
    <comment_count>2</comment_count>
    <who name="Mike Gorse">mgorse</who>
    <bug_when>2024-12-08 07:02:02 -0800</bug_when>
    <thetext>The object triggering this contains one U+fffc character. The code in AccessibilityObjectAtspi::TextAttributes looks like it can recurse into an object&apos;s children, while the caller has a UTF16 -&gt; UTF8 mapping for the text in the object itself, so just the U+fffc character.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086942</commentid>
    <comment_count>3</comment_count>
    <who name="Mike Gorse">mgorse</who>
    <bug_when>2025-01-13 17:30:06 -0800</bug_when>
    <thetext>AccessibilityObjectAtspi::TextAttributes() has this:
    auto firstValidPosition = firstPositionInOrBeforeNode(m_coreObject-&gt;node()-&gt;firstDescendant());
...
    auto startPosition = firstPositionInOrBeforeNode(startRenderer-&gt;node());
    for (RenderObject* r = childRenderer-&gt;previousInPreOrder(); r &amp;&amp; startPosition &gt; firstValidPosition; r = r-&gt;previousInPreOrder()) {
...
    auto startOffset = adjustOutputOffset(m_coreObject-&gt;indexForVisiblePosition(startPosition), m_hasListMarkerAtStart);

startOffset is set to 4, and the code in the loop never executes because
startPosition == firstValidPosition. I think that the accessible is
encapsulating a button labeled &quot;next&quot;, which might be where the 4 is coming
from, but the accessible&apos;s text contains the object replacement character,
rather than &quot;next&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086947</commentid>
    <comment_count>4</comment_count>
    <who name="Mike Gorse">mgorse</who>
    <bug_when>2025-01-13 17:56:51 -0800</bug_when>
    <thetext>Okay, my guess in my last comment was wrong. I tried changing the language on the page to Spanish, which changed the label on the button to &quot;Siguiente,&quot; and the returned attribute offset is still 4. The &quot;create account&quot; button on the same page also triggers the crash for me, and 2 is returned there for the start offset.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088705</commentid>
    <comment_count>5</comment_count>
    <who name="Mike Gorse">mgorse</who>
    <bug_when>2025-01-21 08:53:22 -0800</bug_when>
    <thetext>Marking this as a dup; making the change described in bug 270354 would likely fix this.

*** This bug has been marked as a duplicate of bug 270354 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>