summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2016-02-06 19:28:00 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2016-02-07 08:23:46 -0500
commitea8da35cc190a817cc6f856224152c42806ec814 (patch)
tree8dd5b9f2a368d2c189dbe59f94378f379f5a3daa /regcomp.c
parentc4f643b9fca4c4487ef74e4e6cd5b61a26025698 (diff)
downloadperl-ea8da35cc190a817cc6f856224152c42806ec814.tar.gz
Assert no bad array access.
Coverity CID 135147: Out-of-bounds access (OVERRUN) Long-distance trouble: regexec.c:8922-ish calls (if DEBUGGING) the regprop() in regcomp.c, which can access the five-element bounds[] array with the flags value as the offset. However, Coverity thinks it sees that in regexec.c the flags value may be up to nine.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 639e4a3b1e..d6a3b5b363 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -17659,6 +17659,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
"{sb}",
"{wb}"
};
+ assert(FLAGS(o) < C_ARRAY_LENGTH(bounds));
sv_catpv(sv, bounds[FLAGS(o)]);
}
else if (k == BRANCHJ && (OP(o) == UNLESSM || OP(o) == IFMATCH))