Skip to content

Commit 95ecf2c

Browse files
committed
analysis: fix integer overflow in debug mode
1 parent c7a9f70 commit 95ecf2c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/analysis/function_parameters.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@ pub fn analyze(
240240
}
241241
};
242242

243-
if async_func && to_remove.contains(&(pos - correction_instance)) {
243+
if async_func
244+
&& pos
245+
.checked_sub(correction_instance)
246+
.map(|p| to_remove.contains(&p))
247+
.unwrap_or(false)
248+
{
244249
add_rust_parameter = false;
245250
}
246251
let mut transfer = par.transfer;

src/analysis/functions.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,12 @@ fn analyze_function(
735735
correction_instance = 1;
736736
}
737737

738-
if r#async && to_remove.contains(&(pos - correction_instance)) {
738+
if r#async
739+
&& pos
740+
.checked_sub(correction_instance)
741+
.map(|p| to_remove.contains(&p))
742+
.unwrap_or(false)
743+
{
739744
continue;
740745
}
741746
assert!(

0 commit comments

Comments
 (0)