Skip to content

Commit 763616d

Browse files
jarca0123kjarosh
andcommitted
avm1: Improve qsort compatibility
This patch makes sure compare functions are called in the same order and for the same arguments as in Flash Player. Co-authored-by: Kamil Jarosz <[email protected]>
1 parent 8d5d26a commit 763616d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

core/src/avm1/globals/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ fn qsort<'gc>(
744744

745745
loop {
746746
// Find an element greater than the pivot from the left.
747-
while left <= high {
747+
while left < right {
748748
let (_, item) = &elements[left];
749749
if compare_fn(activation, &pivot, item, options)?.is_le() {
750750
break;
@@ -775,10 +775,10 @@ fn qsort<'gc>(
775775
elements.swap(low, right);
776776

777777
// Push subarrays onto the stack for further sorting.
778+
stack.push((right + 1, high));
778779
if right > 0 {
779780
stack.push((low, right - 1));
780781
}
781-
stack.push((right + 1, high));
782782
}
783783

784784
Ok(())
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
num_frames = 1
2-
known_failure = true

0 commit comments

Comments
 (0)