From 88e60c309c0e05970cfed012f5b1eae98ad92bbb Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Thu, 12 Sep 2024 17:28:53 -0500 Subject: [PATCH] Add overflow check. --- src/core/peg.c | 1 + 1 file changed, 1 insertion(+) 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);