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:
507a848
)
regcomp.c: Add assertion
author
Karl Williamson
<public@khwilliamson.com>
Wed, 28 Sep 2011 04:18:20 +0000
(22:18 -0600)
committer
Karl Williamson
<public@khwilliamson.com>
Sat, 1 Oct 2011 15:15:32 +0000
(09:15 -0600)
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.
regcomp.c
patch
|
blob
|
history
diff --git
a/regcomp.c
b/regcomp.c
index
ec8b3c1
..
1fa5e24
100644
(file)
--- 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