RESOLVED FIXED 268075
[JSC] TypedArray sorting methods should have a special-case for comparator returning `false`
https://bugs.webkit.org/show_bug.cgi?id=268075
Summary [JSC] TypedArray sorting methods should have a special-case for comparator re...
xiaochen guo
Reported 2024-01-25 06:18:47 PST
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) => { return x < 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 '100, 100, 30, 10, 8, 7, 6, 5, 3, 3'. I have also tested this in other JavaScript engines, and the results align with expectations. I believe this could potentially pose a security issue.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-02-01 06:19:14 PST
Alexey Shvayka
Comment 2 2024-03-14 14:10:41 PDT
EWS
Comment 3 2024-03-14 17:59:16 PDT
Committed 276130@main (798d1789439a): <https://commits.webkit.org/276130@main> Reviewed commits have been landed. Closing PR #25902 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.