diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-03-26 15:09:47 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-03-26 15:09:47 +0000 |
commit | 036fb02d280970ad6811c940cc8fb8d813a6dcab (patch) | |
tree | 016cfeb9459387b36dcad77f77413828db97ae4b | |
parent | 0948ced6ee1d72bed977544e5f6e015db66c9a73 (diff) | |
download | pcre-036fb02d280970ad6811c940cc8fb8d813a6dcab.tar.gz |
Fix multiline ^$ bug when newline=any.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@130 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | pcre_dfa_exec.c | 9 | ||||
-rw-r--r-- | pcre_exec.c | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c index e952d68..42bcbb9 100644 --- a/pcre_dfa_exec.c +++ b/pcre_dfa_exec.c @@ -2308,6 +2308,15 @@ for (;;) { while (current_subject <= end_subject && !WAS_NEWLINE(current_subject)) current_subject++; + + /* If we have just passed a CR and the newline option is ANY, and we + are now at a LF, advance the match position by one more character. */ + + if (current_subject[-1] == '\r' && + md->nltype == NLTYPE_ANY && + current_subject < end_subject && + *current_subject == '\n') + current_subject++; } } diff --git a/pcre_exec.c b/pcre_exec.c index b321456..011a931 100644 --- a/pcre_exec.c +++ b/pcre_exec.c @@ -4013,6 +4013,15 @@ for(;;) { while (start_match <= end_subject && !WAS_NEWLINE(start_match)) start_match++; + + /* If we have just passed a CR and the newline option is ANY, and we are + now at a LF, advance the match position by one more character. */ + + if (start_match[-1] == '\r' && + md->nltype == NLTYPE_ANY && + start_match < end_subject && + *start_match == '\n') + start_match++; } } |