summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-09-27 22:18:20 -0600
committerKarl Williamson <public@khwilliamson.com>2011-10-01 09:15:32 -0600
commit32f89ef61d006e06f334c5a094e4ef398f4fcdbb (patch)
tree5744878a702e874f9e42671bf5766ab03f03cf57 /regcomp.c
parent507a8485b8808f21cd35d0d4d190f33367d3773a (diff)
downloadperl-32f89ef61d006e06f334c5a094e4ef398f4fcdbb.tar.gz
regcomp.c: Add assertion
This is to guard against misuse of the functions. There is no guard currently in the underlying Perl functions to lengthening a string beyond the capacity to hold it.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index ec8b3c179e..1fa5e24541 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5955,6 +5955,8 @@ S_invlist_set_len(pTHX_ SV* const invlist, const UV len)
*get_invlist_len_addr(invlist) = len;
+ assert(len <= SvLEN(invlist));
+
SvCUR_set(invlist, TO_INTERNAL_SIZE(len));
/* If the list contains U+0000, that element is part of the header,
* and should not be counted as part of the array. It will contain