Skip to content

Commit

Permalink
Detect overflow in proc_macro_server subspan
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiasko committed Sep 4, 2020
1 parent d245464 commit b54386a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_expand/src/proc_macro_server.rs
Expand Up @@ -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,
};
Expand Down

0 comments on commit b54386a

Please sign in to comment.