Merge pull request #21492 from azat/client-fix-highlight-multiline-comment

Fix heap-buffer-overflow in highlighting multi-line comments
This commit is contained in:
alexey-milovidov 2021-03-26 02:48:21 +03:00 committed by GitHub
commit 40a99b7431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 2 deletions

View File

@ -275,7 +275,8 @@ Token Lexer::nextTokenImpl()
else
++pos;
}
return Token(TokenType::ErrorMultilineCommentIsNotClosed, token_begin, end);
pos = end;
return Token(TokenType::ErrorMultilineCommentIsNotClosed, token_begin, pos);
}
}
return Token(TokenType::Slash, token_begin, pos);

View File

@ -0,0 +1,25 @@
#!/usr/bin/expect -f
log_user 0
set timeout 5
match_max 100000
# A default timeout action is to do nothing, change it to fail
expect_after {
timeout {
exit 2
}
}
set basedir [file dirname $argv0]
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT"
expect ":) "
# regression for heap-buffer-overflow issue (under ASAN)
send -- "/**"
expect "/**"
# just in case few more bytes
send -- "foobar"
expect "/**foobar"
send -- "\3\4"
expect eof

View File

@ -212,6 +212,7 @@
01017_uniqCombined_memory_usage
01747_join_view_filter_dictionary
01748_dictionary_table_dot
01755_client_highlight_multi_line_comment_regression
00950_dict_get
01683_flat_dictionary
01681_cache_dictionary_simple_key

View File

@ -95,7 +95,8 @@
"01370_client_autocomplete_word_break_characters",
"01676_clickhouse_client_autocomplete",
"01193_metadata_loading",
"01455_time_zones"
"01455_time_zones",
"01755_client_highlight_multi_line_comment_regression"
],
"release-build": [
],