<?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>268075</bug_id>
          
          <creation_ts>2024-01-25 06:18:47 -0800</creation_ts>
          <short_desc>[JSC] TypedArray sorting methods should have a special-case for comparator returning `false`</short_desc>
          <delta_ts>2024-03-14 17:59:18 -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>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=47825</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="xiaochen guo">M202271709</reporter>
          <assigned_to name="Alexey Shvayka">ashvayka</assigned_to>
          <cc>ashvayka</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2007545</commentid>
    <comment_count>0</comment_count>
    <who name="xiaochen guo">M202271709</who>
    <bug_when>2024-01-25 06:18:47 -0800</bug_when>
    <thetext>Execute the poc.js below.

let arr = [10, 3, 8, 5, 30, 100, 6, 7, 100, 3]
let obj = new Int8Array(arr);
print(obj.toSorted((x, y) =&gt; { return x &lt; y }))

output: 10,3,8,5,30,100,6,7,100,3
expect: 100,100,30,10,8,7,6,5,3,3

Due to the fact that each element in the Int8Array is a number, the expected result of descending sorting would be &apos;100, 100, 30, 10, 8, 7, 6, 5, 3, 3&apos;. I have also tested this in other JavaScript engines, and the results align with expectations. I believe this could potentially pose a security issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2009719</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-02-01 06:19:14 -0800</bug_when>
    <thetext>&lt;rdar://problem/122093956&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2021125</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Shvayka">ashvayka</who>
    <bug_when>2024-03-14 14:10:41 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/25902</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2021199</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-03-14 17:59:16 -0700</bug_when>
    <thetext>Committed 276130@main (798d1789439a): &lt;https://commits.webkit.org/276130@main&gt;

Reviewed commits have been landed. Closing PR #25902 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>