github-actions[bot] commented on code in PR #68428:
URL: https://github.com/apache/doris/pull/68428#discussion_r4083857205
##########
be/src/exprs/function/function_regexp.cpp:
##########
@@ -55,6 +55,20 @@
namespace doris {
+static bool advance_re2_search_position(const char* data, size_t size,
+ const re2::StringPiece& match, size_t&
pos) {
+ const size_t match_pos = match.data() - data;
+ if (match.empty()) {
+ if (match_pos == size) {
+ return false;
+ }
+ pos = match_pos + 1;
Review Comment:
[P1] Advance empty matches by a UTF-8 character
RE2 runs in UTF-8 mode by default, so `match_pos + 1` can leave the next
search inside a valid multibyte character. For example, with UTF-8 `é` (`C3
A9`), `regexp_count('é', '^|\\C')` first takes the empty `^` at byte 0, sets
`pos` to byte 1, and then lets `\\C` consume the trailing `A9`, returning 1
instead of 0. `(?:^)|(\\C)` likewise makes both extract-all forms emit that
one-byte invalid UTF-8 capture. This is distinct from the earlier
late-match-offset thread: here `match_pos == pos`, but the `+1` unit is wrong.
Please advance by one decoded UTF-8 rune (falling back to one byte for
malformed input), retain the end check, and cover these three functions with a
multibyte regression.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]