summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-12-22 20:23:28 +0000
committerDavid Mitchell <davem@iabyn.com>2014-12-31 11:28:52 +0000
commitea11461288d14099c29bf480cfd98479d3613a9c (patch)
treed574023fc2be5f170b87053f2e46cf9ddcc83fe6 /regcomp.c
parente68aed92f594456b596d9b3d8c0fba00406fe76d (diff)
downloadperl-ea11461288d14099c29bf480cfd98479d3613a9c.tar.gz
fix integer overflow in S_study_chunk().
Don't increment delta if it's "infinity" (SSize_t_MAX) Found by -fsanitize=undefined: regcomp.c:4999:11: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'ssize_t' (aka 'long')
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index 4f5753a27b..b11047fe9a 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5022,7 +5022,8 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVuf" RHS=%"UVuf"\n",
flags &= ~SCF_DO_STCLASS;
}
min++;
- delta++; /* Because of the 2 char string cr-lf */
+ if (delta != SSize_t_MAX)
+ delta++; /* Because of the 2 char string cr-lf */
if (flags & SCF_DO_SUBSTR) {
/* Cannot expect anything... */
scan_commit(pRExC_state, data, minlenp, is_inf);