buffer: fix crash for invalid index types #25154
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a forward-port of v10.x’s #23795, which was originally targeting master, to fix #23668.
As part of the discussion back then, we wanted to explore a “fix” for v11.x and master that involved introducing typechecking along the lines of #23840, but since that hasn’t happened, it seems like a good idea to apply this on all affected branches, in order to make sure the bug is fixed everywhere.
This does not keep #23840 from happening in any way (except that this makes it a semver-major PR).
2555cb4 introduced a crash
when a non-number value was passed to
ParseArrayIndex()
.We do not always have JS typechecking for that in place, though.
This returns back to the previous behavior of coercing values
to integers, which is certainly questionable.
Refs: #22129
Fixes: #23668
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes