Skip to content

Commit b54386a

Browse files
committed
Detect overflow in proc_macro_server subspan
1 parent d245464 commit b54386a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_expand/src/proc_macro_server.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -584,12 +584,12 @@ impl server::Literal for Rustc<'_> {
584584

585585
let start = match start {
586586
Bound::Included(lo) => lo,
587-
Bound::Excluded(lo) => lo + 1,
587+
Bound::Excluded(lo) => lo.checked_add(1)?,
588588
Bound::Unbounded => 0,
589589
};
590590

591591
let end = match end {
592-
Bound::Included(hi) => hi + 1,
592+
Bound::Included(hi) => hi.checked_add(1)?,
593593
Bound::Excluded(hi) => hi,
594594
Bound::Unbounded => length,
595595
};

0 commit comments

Comments
 (0)