Skip to content

Commit

Permalink
Merge pull request #1471 from kawadakk/patches/fix-param-index-oob
Browse files Browse the repository at this point in the history
analysis: Avoid overflow when determining whether to emit a parameter
  • Loading branch information
sdroege authored May 12, 2023
2 parents 72e0c43 + 771a769 commit 55b381b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/analysis/function_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ pub fn analyze(
}
};

if async_func && to_remove.contains(&(pos - correction_instance)) {
if async_func
&& pos >= correction_instance
&& to_remove.contains(&(pos - correction_instance))
{
add_rust_parameter = false;
}
let mut transfer = par.transfer;
Expand Down
5 changes: 4 additions & 1 deletion src/analysis/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,10 @@ fn analyze_function(
correction_instance = 1;
}

if r#async && to_remove.contains(&(pos - correction_instance)) {
if r#async
&& pos >= correction_instance
&& to_remove.contains(&(pos - correction_instance))
{
continue;
}
assert!(
Expand Down

0 comments on commit 55b381b

Please sign in to comment.