aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2024-09-12 17:28:53 -0500
committerCalvin Rose <calsrose@gmail.com>2024-09-12 17:28:53 -0500
commit88e60c309c0e05970cfed012f5b1eae98ad92bbb (patch)
tree70abc9da82b61fcb47db504e633f1abf77cbb4d6
parentAdd rules for nth and only-tags. Address #1503 (diff)
Add overflow check.
-rw-r--r--src/core/peg.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/core/peg.c b/src/core/peg.c
index 0a2b7d4f..f2e70213 100644
--- a/src/core/peg.c
+++ b/src/core/peg.c
@@ -498,6 +498,7 @@ tail:
case RULE_NTH: {
uint32_t nth = rule[1];
+ if (nth > INT32_MAX) nth = INT32_MAX;
uint32_t tag = rule[3];
int oldmode = s->mode;
CapState cs = cap_save(s);