summaryrefslogtreecommitdiffstats
path: root/vendor/regex/src/re_trait.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/regex/src/re_trait.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/regex/src/re_trait.rs')
-rw-r--r--vendor/regex/src/re_trait.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/vendor/regex/src/re_trait.rs b/vendor/regex/src/re_trait.rs
index d0c717df5..505810c84 100644
--- a/vendor/regex/src/re_trait.rs
+++ b/vendor/regex/src/re_trait.rs
@@ -20,7 +20,7 @@ impl Locations {
/// not match anything. The positions returned are *always* byte indices
/// with respect to the original string matched.
pub fn pos(&self, i: usize) -> Option<(usize, usize)> {
- let (s, e) = (i * 2, i * 2 + 1);
+ let (s, e) = (i.checked_mul(2)?, i.checked_mul(2)?.checked_add(1)?);
match (self.0.get(s), self.0.get(e)) {
(Some(&Some(s)), Some(&Some(e))) => Some((s, e)),
_ => None,