summaryrefslogtreecommitdiffstats
path: root/vendor/regex-syntax/src/hir
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-syntax/src/hir
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-syntax/src/hir')
-rw-r--r--vendor/regex-syntax/src/hir/mod.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/vendor/regex-syntax/src/hir/mod.rs b/vendor/regex-syntax/src/hir/mod.rs
index e5ea3701b..062d4dcab 100644
--- a/vendor/regex-syntax/src/hir/mod.rs
+++ b/vendor/regex-syntax/src/hir/mod.rs
@@ -2481,16 +2481,24 @@ impl Properties {
props.literal = props.literal && p.is_literal();
props.alternation_literal =
props.alternation_literal && p.is_alternation_literal();
- if let Some(ref mut minimum_len) = props.minimum_len {
+ if let Some(minimum_len) = props.minimum_len {
match p.minimum_len() {
None => props.minimum_len = None,
- Some(len) => *minimum_len += len,
+ Some(len) => {
+ // We use saturating arithmetic here because the
+ // minimum is just a lower bound. We can't go any
+ // higher than what our number types permit.
+ props.minimum_len =
+ Some(minimum_len.saturating_add(len));
+ }
}
}
- if let Some(ref mut maximum_len) = props.maximum_len {
+ if let Some(maximum_len) = props.maximum_len {
match p.maximum_len() {
None => props.maximum_len = None,
- Some(len) => *maximum_len += len,
+ Some(len) => {
+ props.maximum_len = maximum_len.checked_add(len)
+ }
}
}
}