diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-08-04 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-09-04 21:35:56 +0200 |
| commit | b54386ab7a9da8a4f22db3a35a9ec7b0f2b98b6c (patch) | |
| tree | 2587489ef2472e7261e1864c0c41f75f5a598597 | |
| parent | d2454643e137bde519786ee9e650c455d7ad6f34 (diff) | |
| download | rust-b54386ab7a9da8a4f22db3a35a9ec7b0f2b98b6c.tar.gz rust-b54386ab7a9da8a4f22db3a35a9ec7b0f2b98b6c.zip | |
Detect overflow in proc_macro_server subspan
| -rw-r--r-- | compiler/rustc_expand/src/proc_macro_server.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 39c82f97e0a..5a728bbda96 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -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, }; |
