projects
/
platform
/
upstream
/
perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9597860
)
[perl #118175] avoid making a pointer outside a string
author
Tony Cook
<tony@develop-help.com>
Sat, 1 Jun 2013 02:33:05 +0000
(12:33 +1000)
committer
Tony Cook
<tony@develop-help.com>
Mon, 3 Jun 2013 12:05:27 +0000
(22:05 +1000)
Simply adding scan + max causes undefined behaviour per ANSI C if the
result points outside of the object scan points at.
regexec.c
patch
|
blob
|
history
diff --git
a/regexec.c
b/regexec.c
index
87a0d73
..
d29f6dd
100644
(file)
--- 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