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

Fix out of bounds access by checking length equality BEFORE accessing by index. #5784

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Jul 11, 2020

Fixes #5780

changelog: fix out of bounds access in unnested_or_patterns lint.

Edit: I did not bother reducing a testcase from librustc_typeck crate but I can confirm that with the change the crash no longer occurs.

@rust-highfive
Copy link

r? @phansch

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 11, 2020
@phansch
Copy link
Member

phansch commented Jul 12, 2020

I did not bother reducing a testcase from librustc_typeck crate but I can confirm that with the change the crash no longer occurs.

Yeah, I agree that would be pretty difficult 😅 Since it only happened in rustc so far, let's just go ahead and

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 12, 2020

📌 Commit 1b3bc16 has been approved by phansch

@bors
Copy link
Collaborator

bors commented Jul 12, 2020

⌛ Testing commit 1b3bc16 with merge 696e887...

bors added a commit that referenced this pull request Jul 12, 2020
Fix out of bounds access by checking length equality BEFORE accessing by index.

Fixes #5780

changelog: fix out of bounds access in unnested_or_patterns lint.

Edit: I did not bother reducing a testcase from `librustc_typeck` crate but I can confirm that with the change the crash no longer occurs.
@bors
Copy link
Collaborator

bors commented Jul 12, 2020

💔 Test failed - checks-action_test

@flip1995
Copy link
Member

@bors rollup=always

@flip1995
Copy link
Member

@bors retry

flip1995 added a commit to flip1995/rust-clippy that referenced this pull request Jul 13, 2020
Fix out of bounds access by checking length equality BEFORE accessing by index.

Fixes rust-lang#5780

changelog: fix out of bounds access in unnested_or_patterns lint.

Edit: I did not bother reducing a testcase from `librustc_typeck` crate but I can confirm that with the change the crash no longer occurs.
This was referenced Jul 13, 2020
bors added a commit that referenced this pull request Jul 13, 2020
Rollup of 5 pull requests

Successful merges:

 - #5443 (Some accuracy lints for floating point operations)
 - #5752 (Move range_minus_one to pedantic)
 - #5756 (unnecessary_sort_by: avoid linting if key borrows)
 - #5784 (Fix out of bounds access by checking length equality BEFORE accessing by index.)
 - #5786 (fix phrase in new_lint issue template)

Failed merges:

r? @ghost

changelog: rollup
@bors bors merged commit 26ede31 into rust-lang:master Jul 13, 2020
@flip1995 flip1995 mentioned this pull request Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: unnested_or_patterns while checking rustc_typeck
5 participants