Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array#sort aborts when elements are deleted #113

Closed
devsnek opened this issue Jan 10, 2019 · 2 comments
Closed

Array#sort aborts when elements are deleted #113

devsnek opened this issue Jan 10, 2019 · 2 comments

Comments

@devsnek
Copy link

devsnek commented Jan 10, 2019

While testing tc39/ecma262#302 I came across an issue where deleting array elements while sorting causes address boundary errors.

Repro code:

'use strict';

const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let first = true;
array.sort((a, b) => {
  if (first) {
    first = false;
    for (let i = 0; i < array.length; i += 1) {
      delete array[i];
    }
  }
  return a - b;
});
@phoddie
Copy link
Collaborator

phoddie commented Jan 10, 2019

Nice one. We'll take a look. Thanks.

@phoddie
Copy link
Collaborator

phoddie commented Jan 29, 2019

This is now fixed. Thank you for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants