Rollup merge of #75146 - tmiasko:range-overflow, r=Mark-Simulacrum
Detect overflow in proc_macro_server subspan * Detect overflow in proc_macro_server subspan * Add tests for overflow in Vec::drain * Add tests for overflow in String / VecDeque operations using ranges
This commit is contained in:
commit
fb9bb2b5ca
5 changed files with 72 additions and 2 deletions
|
@ -584,12 +584,12 @@ impl server::Literal for Rustc<'_> {
|
|||
|
||||
let start = match start {
|
||||
Bound::Included(lo) => lo,
|
||||
Bound::Excluded(lo) => lo + 1,
|
||||
Bound::Excluded(lo) => lo.checked_add(1)?,
|
||||
Bound::Unbounded => 0,
|
||||
};
|
||||
|
||||
let end = match end {
|
||||
Bound::Included(hi) => hi + 1,
|
||||
Bound::Included(hi) => hi.checked_add(1)?,
|
||||
Bound::Excluded(hi) => hi,
|
||||
Bound::Unbounded => length,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue