Bug #91266 Test main.regular_expressions_utf-8 triggers an error under Valgrind
Submitted: 14 Jun 23:19 Modified: 24 Jun 5:12
Reporter: Herman Lee Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any
Tags: valgrind

[14 Jun 23:19] Herman Lee
Description:
When building and running MySQL 8.0.11 unittests with valgrind, the test main.regular_expressions_utf-8 triggers a "Conditional jump or move depends on uninitialised value" error with the following trace:

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
main.regular_expressions_utf-8           [ fail ]  Found warnings/errors in server log file!
        Test ended at 2018-06-14 14:12:04
line
==1241560== Thread 34:
==1241560== Conditional jump or move depends on uninitialised value(s)
==1241560==    at 0x3F9C28A: icu_59::RegexCImpl::appendReplacement(icu_59::RegularExpression*, char16_t const*, int, char16_t**, int*, UErrorCode*) (uregex.cpp:1469)
==1241560==    by 0x3F9BAC2: uregex_appendReplacement_59 (uregex.cpp:1593)
==1241560==    by 0x31701CD: regexp::Regexp_engine::TryToAppendReplacement(char16_t const*, unsigned long) (regexp_engine.cc:155)
==1241560==    by 0x3170219: regexp::Regexp_engine::AppendReplacement(char16_t const*, unsigned long) (regexp_engine.cc:161)
==1241560==    by 0x316FE76: regexp::Regexp_engine::Replace(char const*, int, int, int, String*) (regexp_engine.cc:97)
==1241560==    by 0x3171589: regexp::Regexp_facade::Replace(Item*, Item*, long, int, String*) (regexp_facade.cc:114)
==1241560==    by 0x3089042: Item_func_regexp_replace::val_str(String*) (item_regexp_func.cc:205)
==1241560==    by 0x2FD8507: Item::send(Protocol*, String*) (item.cc:6482)
==1241560==    by 0x2BEB9A7: THD::send_result_set_row(List<Item>*) (sql_class.cc:2566)
==1241560==    by 0x316C6AF: Query_result_send::send_data(List<Item>&) (query_result.cc:98)
==1241560==    by 0x2C0DDCF: JOIN::exec() (sql_executor.cc:254)
==1241560==    by 0x2CC9DD5: Sql_cmd_dml::execute_inner(THD*) (sql_select.cc:651)
==1241560==    by 0x2CC98E9: Sql_cmd_dml::execute(THD*) (sql_select.cc:554)
==1241560==    by 0x2C6ECC2: mysql_execute_command(THD*, bool) (sql_parse.cc:4220)
==1241560==    by 0x2C711E6: mysql_parse(THD*, Parser_state*) (sql_parse.cc:4935)
==1241560==    by 0x2C66E75: dispatch_command(THD*, COM_DATA const*, enum_server_command) (sql_parse.cc:1589)
==1241560== Conditional jump or move depends on uninitialised value(s)
==1241560==    at 0x3FE359A: u_isdigit_59 (uchar.cpp:124)
==1241560==    by 0x3F9C385: icu_59::RegexCImpl::appendReplacement(icu_59::RegularExpression*, char16_t const*, int, char16_t**, int*, UErrorCode*) (uregex.cpp:1470)
==1241560==    by 0x3F9BAC2: uregex_appendReplacement_59 (uregex.cpp:1593)
==1241560==    by 0x31701CD: regexp::Regexp_engine::TryToAppendReplacement(char16_t const*, unsigned long) (regexp_engine.cc:155)
==1241560==    by 0x3170219: regexp::Regexp_engine::AppendReplacement(char16_t const*, unsigned long) (regexp_engine.cc:161)
==1241560==    by 0x316FE76: regexp::Regexp_engine::Replace(char const*, int, int, int, String*) (regexp_engine.cc:97)
==1241560==    by 0x3171589: regexp::Regexp_facade::Replace(Item*, Item*, long, int, String*) (regexp_facade.cc:114)
==1241560==    by 0x3089042: Item_func_regexp_replace::val_str(String*) (item_regexp_func.cc:205)
==1241560==    by 0x2FD8507: Item::send(Protocol*, String*) (item.cc:6482)
==1241560==    by 0x2BEB9A7: THD::send_result_set_row(List<Item>*) (sql_class.cc:2566)
==1241560==    by 0x316C6AF: Query_result_send::send_data(List<Item>&) (query_result.cc:98)
==1241560==    by 0x2C0DDCF: JOIN::exec() (sql_executor.cc:254)
==1241560==    by 0x2CC9DD5: Sql_cmd_dml::execute_inner(THD*) (sql_select.cc:651)
==1241560==    by 0x2CC98E9: Sql_cmd_dml::execute(THD*) (sql_select.cc:554)
==1241560==    by 0x2C6ECC2: mysql_execute_command(THD*, bool) (sql_parse.cc:4220)
==1241560==    by 0x2C711E6: mysql_parse(THD*, Parser_state*) (sql_parse.cc:4935)
==1241560== Use of uninitialised value of size 8
==1241560==    at 0x3FE35B3: u_isdigit_59 (uchar.cpp:124)
==1241560==    by 0x3F9C385: icu_59::RegexCImpl::appendReplacement(icu_59::RegularExpression*, char16_t const*, int, char16_t**, int*, UErrorCode*) (uregex.cpp:1470)
==1241560==    by 0x3F9BAC2: uregex_appendReplacement_59 (uregex.cpp:1593)
==1241560==    by 0x31701CD: regexp::Regexp_engine::TryToAppendReplacement(char16_t const*, unsigned long) (regexp_engine.cc:155)
==1241560==    by 0x3170219: regexp::Regexp_engine::AppendReplacement(char16_t const*, unsigned long) (regexp_engine.cc:161)
==1241560==    by 0x316FE76: regexp::Regexp_engine::Replace(char const*, int, int, int, String*) (regexp_engine.cc:97)
==1241560==    by 0x3171589: regexp::Regexp_facade::Replace(Item*, Item*, long, int, String*) (regexp_facade.cc:114)
==1241560==    by 0x3089042: Item_func_regexp_replace::val_str(String*) (item_regexp_func.cc:205)
==1241560==    by 0x2FD8507: Item::send(Protocol*, String*) (item.cc:6482)
==1241560==    by 0x2BEB9A7: THD::send_result_set_row(List<Item>*) (sql_class.cc:2566)
==1241560==    by 0x316C6AF: Query_result_send::send_data(List<Item>&) (query_result.cc:98)
==1241560==    by 0x2C0DDCF: JOIN::exec() (sql_executor.cc:254)
==1241560==    by 0x2CC9DD5: Sql_cmd_dml::execute_inner(THD*) (sql_select.cc:651)
==1241560==    by 0x2CC98E9: Sql_cmd_dml::execute(THD*) (sql_select.cc:554)
==1241560==    by 0x2C6ECC2: mysql_execute_command(THD*, bool) (sql_parse.cc:4220)
==1241560==    by 0x2C711E6: mysql_parse(THD*, Parser_state*) (sql_parse.cc:4935)
==1241560== Use of uninitialised value of size 8
==1241560==    at 0x3FE36BC: u_isdigit_59 (uchar.cpp:124)
==1241560==    by 0x3F9C385: icu_59::RegexCImpl::appendReplacement(icu_59::RegularExpression*, char16_t const*, int, char16_t**, int*, UErrorCode*) (uregex.cpp:1470)
==1241560==    by 0x3F9BAC2: uregex_appendReplacement_59 (uregex.cpp:1593)
==1241560==    by 0x31701CD: regexp::Regexp_engine::TryToAppendReplacement(char16_t const*, unsigned long) (regexp_engine.cc:155)
==1241560==    by 0x3170219: regexp::Regexp_engine::AppendReplacement(char16_t const*, unsigned long) (regexp_engine.cc:161)
==1241560==    by 0x316FE76: regexp::Regexp_engine::Replace(char const*, int, int, int, String*) (regexp_engine.cc:97)
==1241560==    by 0x3171589: regexp::Regexp_facade::Replace(Item*, Item*, long, int, String*) (regexp_facade.cc:114)
==1241560==    by 0x3089042: Item_func_regexp_replace::val_str(String*) (item_regexp_func.cc:205)
==1241560==    by 0x2FD8507: Item::send(Protocol*, String*) (item.cc:6482)
==1241560==    by 0x2BEB9A7: THD::send_result_set_row(List<Item>*) (sql_class.cc:2566)
==1241560==    by 0x316C6AF: Query_result_send::send_data(List<Item>&) (query_result.cc:98)
==1241560==    by 0x2C0DDCF: JOIN::exec() (sql_executor.cc:254)
==1241560==    by 0x2CC9DD5: Sql_cmd_dml::execute_inner(THD*) (sql_select.cc:651)
==1241560==    by 0x2CC98E9: Sql_cmd_dml::execute(THD*) (sql_select.cc:554)
==1241560==    by 0x2C6ECC2: mysql_execute_command(THD*, bool) (sql_parse.cc:4220)
==1241560==    by 0x2C711E6: mysql_parse(THD*, Parser_state*) (sql_parse.cc:4935)
^ Found warnings in /data/users/herman/rocks-mysql/8.0/_build-8.0-Valgrind/mysql-test/var/log/mysqld.1.err
ok

How to repeat:
Build mysql 8.0.11 with Valgrind.

Then execute 

mysql-test-run.pl --valgrind main.regular_expressions_utf-8
[15 Jun 3:01] Miguel Solorzano
Thank you for the bug report, verified as described.
[24 Jun 5:12] Erlend Dahl
I can repeat this on 8.0.11, but not on 8.0.12, so it has probably been fixed
in the meantime.