Skip to content

Conversation

smoelius
Copy link
Contributor

#9386 introduced a potential out-of-bounds array access. Specifically, a location returned by local_assignments could have location.statement_index equal to mir.basic_blocks[location.block].statements.len(), in which case the location would refer to the block terminator:

&& let [location] = *local_assignments(mir, local).as_slice()
&& let StatementKind::Assign(box (_, Rvalue::Ref(_, _, place))) =
mir.basic_blocks[location.block].statements[location.statement_index].kind

I suspect the bug is not triggerable now, because of checks leading up to where it occurs. But a future code change could make it triggerable. Hence, it should be fixed.

r? @Jarcho

changelog: none

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 12, 2022
@Jarcho
Copy link
Contributor

Jarcho commented Oct 20, 2022

Thank you. @bors r+

@bors
Copy link
Contributor

bors commented Oct 20, 2022

📌 Commit 524ec2e has been approved by Jarcho

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Oct 20, 2022

⌛ Testing commit 524ec2e with merge 967f172...

@bors
Copy link
Contributor

bors commented Oct 20, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Jarcho
Pushing 967f172 to master...

@bors bors merged commit 967f172 into rust-lang:master Oct 20, 2022
@smoelius smoelius deleted the fix-9386-bug branch October 20, 2022 15:35
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.

4 participants