summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2013-06-01 12:33:05 +1000
committerTony Cook <tony@develop-help.com>2013-06-03 22:05:27 +1000
commitdfb8f192c83f98bba59d4a8c282ee4cf5bfca8a9 (patch)
treef3ad54ac0121ff802b04e85171df9820f18c4114 /regexec.c
parent9597860a6bc546628ff50b88916291944416e77f (diff)
downloadperl-dfb8f192c83f98bba59d4a8c282ee4cf5bfca8a9.tar.gz
[perl #118175] avoid making a pointer outside a string
Simply adding scan + max causes undefined behaviour per ANSI C if the result points outside of the object scan points at.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index 87a0d7317a..d29f6dd8f4 100644
--- a/regexec.c
+++ b/regexec.c
@@ -6656,7 +6656,7 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
scan = *startposp;
if (max == REG_INFTY)
max = I32_MAX;
- else if (! utf8_target && scan + max < loceol)
+ else if (! utf8_target && loceol - scan > max)
loceol = scan + max;
/* Here, for the case of a non-UTF-8 target we have adjusted <loceol> down