diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-05-13 08:35:23 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-05-18 10:52:39 -0600 |
commit | f9126265bc03faa150614fa80fcd98e7056fb385 (patch) | |
tree | 299c0f2ef4f52fd749ddb312aeed7fac6e35f42f /regexec.c | |
parent | 17163f855fd26aa10245c144199729af4cc7ff81 (diff) | |
download | perl-f9126265bc03faa150614fa80fcd98e7056fb385.tar.gz |
Assertion fails in multi-char regex match
In '"s\N{U+DF}" =~ /\x{00DF}/i, the LHS folds to 'sss', the RHS to 'ss'.
The bug occurs when the RHS tries to match the first two es's, but that
splits the LHS \xDF character, which Perl doesn't know how to handle,
and the assertion got triggered. (This is similar to [perl #72998].)
The solution adopted here is to disallow a partial character match,
as #72998 did as well.
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -6726,9 +6726,12 @@ S_reginclass(pTHX_ const regexp * const prog, register const regnode * const n, STRLEN len; const char * const s = SvPV_const(sv, len); - if (len <= total_foldlen && memEQ(s, - (char*)folded, - len)) + if (len <= total_foldlen + && memEQ(s, (char*)folded, len) + + /* If 0, means matched a partial char. See + * [perl #90536] */ + && map_fold_len_back[len]) { /* Advance the target string ptr to account for @@ -6737,7 +6740,6 @@ S_reginclass(pTHX_ const regexp * const prog, register const regnode * const n, * length. */ if (lenp) { *lenp = map_fold_len_back[len]; - assert(*lenp != 0); /* Otherwise will loop */ } match = TRUE; break; |