-
Notifications
You must be signed in to change notification settings - Fork 25.1k
make sure to check array bounds in VirtualizedSectionList #23710
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
Conversation
analysis-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
|
6c6fb78 to
dcf8519
Compare
cpojer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
This pull request was successfully merged by @vonovak in 929908f. When will my fix make it into a release? | Upcoming Releases |
Summary:
SectionList accesses items outside of the array bounds.
This was discovered when using mobx, which warns you: `[mobx.array] Attempt to read an array index (${index}) that is out of bounds`. This is because `section.data[itemIndex + 1]` goes beyond array length.
This PR adds an array length check and simplifies the code a bit to avoid repetitive `this.props.`
Pull Request resolved: #23710
Differential Revision: D14298557
Pulled By: cpojer
fbshipit-source-id: fee3422ad5b053d91a097c5842f46e78a149c3d5
SectionList accesses items outside of the array bounds.
This was discovered when using mobx, which warns you:
[mobx.array] Attempt to read an array index (${index}) that is out of bounds. This is becausesection.data[itemIndex + 1]goes beyond array length.This PR adds an array length check and simplifies the code a bit to avoid repetitive
this.props.