Changeset: b3a4489bbc85 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b3a4489bbc85
Modified Files:
        monetdb5/modules/mal/pcre.c
Branch: regexp
Log Message:

Making sure the offset is advanced by one in case of empty match


diffs (13 lines):

diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -667,7 +667,8 @@ single_replace(pcre *pcre_code, pcre_ext
                                len_result += addlen;
                        }
                }
-               offset = ovector[1];
+               // In case of an empty match just advance the offset by 1
+               offset = ovector[0] == ovector[1] ? ovector[1] + 1 : ovector[1];
        } while (offset < len_origin_str && global);
        if (offset < len_origin_str) {
                addlen = len_origin_str - offset;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to