diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 895026efc56..023f43aa695 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -426,7 +426,8 @@ fedora install: - installed-database.sql - upgraded-database.sql -cppcheck: +cppcheck: + allow_failure: true stage: sast needs: [] variables: @@ -434,33 +435,57 @@ cppcheck: GIT_SUBMODULE_STRATEGY: normal script: - yum install -y cppcheck diffutils - # --template: use a single-line template + # --template: output format # --force: check large directories without warning # -i: ignore this directory when scanning + # -I: include path, reduces false positives + # related to inability to resolve symbols # -j: run multiple cppcheck threads # Use newline to escape colon in yaml - > - cppcheck --template="{file}:{line}: {severity}: {message}" --force + cppcheck --template="{file}:{line}\n{code}\n{severity}: {message}" --force --check-level=exhaustive client dbug extra include libmariadb libmysqld libservices mysql-test mysys mysys_ssl pcre plugin strings tests unittest vio wsrep-lib sql sql-common storage -istorage/mroonga -istorage/tokudb -istorage/spider -istorage/rocksdb -iextra/ -ilibmariadb/ -istorage/columnstore - --output-file=cppcheck.txt -j $(nproc) - # Parallel jobs may output findings in an nondeterministic order. Sort to match ignorelist. - - cat cppcheck.txt | sort > cppcheck_sorted.txt - # Remove line numbers for diff - - sed 's/:[^:]*:/:/' cppcheck_sorted.txt > cppcheck_sorted_no_line_numbers.txt + -Iinclude -Istorage/innobase/include + --output-file=initial-cppcheck_output.txt -j $(nproc) + # when including {code} in the cppcheck template, some more pre-processing needs to be done + # + # sample cppcheck finding: : + # foo.bar() + # ^ + # : + # + # 1. remove all lines with "^" + # 2. merge every 3 lines into 1 so it can be sorted (example: foo.bar() : ) + # 3. sort to match ignorelist since parallel jobs may output findings in an nondeterministic order + # 4. remove findings likely to be false positives (i.e, "unknown macros") + # 5. remove line numbers for diffing against ignorelist + - | + cat initial-cppcheck_output.txt | grep -v '\^$' > preprocessed-cppcheck_circumflex_removed.txt + cat preprocessed-cppcheck_circumflex_removed.txt | awk 'NR%3==1 {printf "%s", (NR==1) ? "" : "\n"; printf "%s", $0} NR%3!=1 {printf " %s", $0}' > preprocessed-cppcheck_oneline.txt + cat preprocessed-cppcheck_oneline.txt | sort > preprocessed-cppcheck_sorted.txt + cat preprocessed-cppcheck_sorted.txt | grep -v "There is an unknown macro here somewhere" > results-cppcheck_all_findings.txt + sed 's/:[0-9]\+//' results-cppcheck_all_findings.txt > preprocessed_final-cppcheck_no_line_nums.txt # Only print new issues not found in ignore list - echo "Problems found in ignore list that were not discovered by cppcheck (may have been fixed)." - - diff --changed-group-format='%>' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt || true + - diff --changed-group-format='%>' --unchanged-group-format='' preprocessed_final-cppcheck_no_line_nums.txt tests/code_quality/cppcheck_ignorelist.txt || true - echo "Problems found by cppcheck that were not in ignore list." - - diff --changed-group-format='%<' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt > lines_not_ignored.txt || true - - cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt + - diff --changed-group-format='%<' --unchanged-group-format='' preprocessed_final-cppcheck_no_line_nums.txt tests/code_quality/cppcheck_ignorelist.txt > results-cppcheck_new_findings.txt || true + - cat results-cppcheck_new_findings.txt && test ! -s results-cppcheck_new_findings.txt artifacts: when: always paths: - - cppcheck_sorted.txt + # save all steps of pre-processing in-case it ever breaks + - initial-cppcheck_output.txt + - preprocessed-cppcheck_circumflex_removed.txt + - preprocessed-cppcheck_sorted.txt + - preprocessed_final-cppcheck_no_line_nums.txt + - results-cppcheck_all_findings.txt + - results-cppcheck_new_findings.txt flawfinder: + allow_failure: true stage: sast needs: [] variables: @@ -482,11 +507,12 @@ flawfinder: - echo "Problems found in ignore list that were not discovered by flawfinder (may have been fixed)." - diff --changed-group-format='%>' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json || true - echo "Problems found by flawfinder that were not in ignore list." - - diff --changed-group-format='%<' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json > lines_not_ignored.txt || true - - cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt + - diff --changed-group-format='%<' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json > flawfinder_new_findings.txt || true + - cat flawfinder_new_findings.txt && test ! -s flawfinder_new_findings.txt artifacts: when: always paths: + - flawfinder_new_findings.txt - flawfinder-all-vulnerabilities.html - flawfinder-min-level5.json diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index 1eacb36bc4e..6df832deafd 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -4978,3 +4978,114 @@ a 0 DROP TABLE t1; End of 10.4 tests +# +# MDEV-29363: Constant subquery causing a crash in pushdown optimization +# +CREATE TABLE t1 (a INT, b INT, c INT); +INSERT INTO t1 VALUES (3, 3, 4), (NULL, NULL, 2); +EXPLAIN FORMAT=JSON SELECT a,b,c FROM t1 GROUP BY a,b,c +HAVING a = (SELECT MIN(b) AS min_b FROM t1) and (a = b or a = c); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "sort_key": "t1.b, t1.c", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a = (subquery#2) and (t1.b = (subquery#2) or t1.c = (subquery#2))" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } + } + } +} +SELECT a,b,c FROM t1 GROUP BY a,b,c +HAVING a = (SELECT MIN(b) AS min_b FROM t1) and (a = b or a = c); +a b c +3 3 4 +EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a,b +HAVING a = (SELECT MIN(a) AS min_a FROM t1) AND (a = 3 or a > b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a = (subquery#2) and (1 or (subquery#2) > t1.b)" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } + } + } +} +SELECT a FROM t1 GROUP BY a,b +HAVING a = (SELECT MIN(a) AS min_a FROM t1) AND (a = 3 or a > b); +a +3 +DROP TABLE t1; +# +# MDEV-32424: Pushdown: server crashes at JOIN::save_explain_data() +# (fixed by the patch for MDEV-29363) +# +CREATE TABLE t1 (a INT, b INT, c INT); +INSERT INTO t1 VALUES (1, 1, 3), (3, 2, 3); +SELECT a,b,c FROM t1 GROUP BY a,b,c +HAVING a = (SELECT MIN(b) AS min_b FROM t1) and a IN (b, c); +a b c +1 1 3 +DROP TABLE t1; +# +# MDEV-32293: Pushdown: server crashes at check_simple_equality() +# (fixed by the patch for MDEV-29363) +# +CREATE VIEW v1 AS SELECT 1 AS a; +SELECT * FROM v1 GROUP BY a HAVING a = 'b' AND a = (a IS NULL); +a +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'b' +DROP VIEW v1; +# +# MDEV-32304: Pushdown: server crashes at Item_field::used_tables() +# (fixed by the patch for MDEV-29363) +# +CREATE VIEW v1 AS SELECT 1 AS a; +SELECT * FROM v1 +GROUP BY a HAVING a = (a IS NULL OR a IS NULL); +a +DROP VIEW v1; +End of 10.5 tests diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index a408f15ebad..24031c0319a 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1502,3 +1502,64 @@ SELECT a FROM t1 GROUP BY a HAVING NOT a; DROP TABLE t1; --echo End of 10.4 tests + +--echo # +--echo # MDEV-29363: Constant subquery causing a crash in pushdown optimization +--echo # + +CREATE TABLE t1 (a INT, b INT, c INT); +INSERT INTO t1 VALUES (3, 3, 4), (NULL, NULL, 2); + +let $q= +SELECT a,b,c FROM t1 GROUP BY a,b,c + HAVING a = (SELECT MIN(b) AS min_b FROM t1) and (a = b or a = c); + +eval EXPLAIN FORMAT=JSON $q; +eval $q; + +let $q= +SELECT a FROM t1 GROUP BY a,b + HAVING a = (SELECT MIN(a) AS min_a FROM t1) AND (a = 3 or a > b); + +eval EXPLAIN FORMAT=JSON $q; +eval $q; + +DROP TABLE t1; + +--echo # +--echo # MDEV-32424: Pushdown: server crashes at JOIN::save_explain_data() +--echo # (fixed by the patch for MDEV-29363) +--echo # + +CREATE TABLE t1 (a INT, b INT, c INT); +INSERT INTO t1 VALUES (1, 1, 3), (3, 2, 3); + +SELECT a,b,c FROM t1 GROUP BY a,b,c + HAVING a = (SELECT MIN(b) AS min_b FROM t1) and a IN (b, c); + +DROP TABLE t1; + +--echo # +--echo # MDEV-32293: Pushdown: server crashes at check_simple_equality() +--echo # (fixed by the patch for MDEV-29363) +--echo # + +CREATE VIEW v1 AS SELECT 1 AS a; + +SELECT * FROM v1 GROUP BY a HAVING a = 'b' AND a = (a IS NULL); + +DROP VIEW v1; + +--echo # +--echo # MDEV-32304: Pushdown: server crashes at Item_field::used_tables() +--echo # (fixed by the patch for MDEV-29363) +--echo # + +CREATE VIEW v1 AS SELECT 1 AS a; + +SELECT * FROM v1 + GROUP BY a HAVING a = (a IS NULL OR a IS NULL); + +DROP VIEW v1; + +--echo End of 10.5 tests diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index fe3fd3421c2..54821377fe0 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -9358,6 +9358,34 @@ QUERY LENGTH(trace)>1 insert into t2 select * from t1 where a<= b and a>4 1 drop table t1, t2; # +# MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled +# +SET @@optimizer_trace='enabled=on'; +CREATE TABLE t1 ( +a CHAR(2) NOT NULL PRIMARY KEY, +b VARCHAR(20) NOT NULL, +KEY (b) +) CHARSET=utf8mb4; +CREATE TABLE t2 ( +a CHAR(2) NOT NULL PRIMARY KEY, +b VARCHAR(20) NOT NULL, +KEY (b) +) CHARSET=utf8mb4; +INSERT INTO t1 VALUES +('AB','MySQLAB'), +('JA','Sun Microsystems'), +('MS','Microsoft'), +('IB','IBM- Inc.'), +('GO','Google Inc.'); +INSERT IGNORE INTO t2 VALUES +('AB','Sweden'), +('JA','USA'), +('MS','United States'), +('IB','North America'), +('GO','South America'); +UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'Unknown%'; +DROP TABLE t1, t2; +# # End of 10.5 tests # # diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index 377141d95c3..6439f74e12c 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -979,6 +979,41 @@ select QUERY, LENGTH(trace)>1 from information_schema.optimizer_trace; drop table t1, t2; +--echo # +--echo # MDEV-34305 Redundant truncation errors/warnings with optimizer_trace enabled +--echo # + +SET @@optimizer_trace='enabled=on'; + +CREATE TABLE t1 ( + a CHAR(2) NOT NULL PRIMARY KEY, + b VARCHAR(20) NOT NULL, + KEY (b) +) CHARSET=utf8mb4; + +CREATE TABLE t2 ( + a CHAR(2) NOT NULL PRIMARY KEY, + b VARCHAR(20) NOT NULL, + KEY (b) +) CHARSET=utf8mb4; + +INSERT INTO t1 VALUES +('AB','MySQLAB'), +('JA','Sun Microsystems'), +('MS','Microsoft'), +('IB','IBM- Inc.'), +('GO','Google Inc.'); + +INSERT IGNORE INTO t2 VALUES +('AB','Sweden'), +('JA','USA'), +('MS','United States'), +('IB','North America'), +('GO','South America'); + +UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'Unknown%'; +DROP TABLE t1, t2; + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/suite/innodb/r/log_file_overwrite.result b/mysql-test/suite/innodb/r/log_file_overwrite.result index 5f1f38784f6..58aa4a32bdb 100644 --- a/mysql-test/suite/innodb/r/log_file_overwrite.result +++ b/mysql-test/suite/innodb/r/log_file_overwrite.result @@ -5,4 +5,17 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 TEXT)ENGINE=InnoDB; INSERT INTO t1 SELECT seq, repeat('a', 4000) FROM seq_1_to_1800; # restart: --debug_dbug=+d,before_final_redo_apply --innodb_log_file_size=8M # restart: --innodb_log_file_size=10M +# +# MDEV-34519 innodb_log_checkpoint_now crashes when +# innodb_read_only is enabled +# +# restart: --innodb-force-recovery=6 +SET GLOBAL innodb_log_checkpoint_now=1; +Warnings: +Warning 138 InnoDB doesn't force checkpoint when innodb-force-recovery=6. +# restart: --innodb-read-only=1 +SET GLOBAL innodb_log_checkpoint_now=1; +Warnings: +Warning 138 InnoDB doesn't force checkpoint when innodb-read-only=1. +# restart DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/log_file_overwrite.test b/mysql-test/suite/innodb/t/log_file_overwrite.test index 209f21c67cd..b6ee84a169c 100644 --- a/mysql-test/suite/innodb/t/log_file_overwrite.test +++ b/mysql-test/suite/innodb/t/log_file_overwrite.test @@ -14,4 +14,18 @@ let $shutdown_timeout=0; let $restart_parameters=--innodb_log_file_size=10M; let $shutdown_timeout=; --source include/restart_mysqld.inc + +--echo # +--echo # MDEV-34519 innodb_log_checkpoint_now crashes when +--echo # innodb_read_only is enabled +--echo # +--let $restart_parameters=--innodb-force-recovery=6 +--source include/restart_mysqld.inc +SET GLOBAL innodb_log_checkpoint_now=1; +--let $restart_parameters=--innodb-read-only=1 +--source include/restart_mysqld.inc +SET GLOBAL innodb_log_checkpoint_now=1; +let $restart_parameters=; +--source include/restart_mysqld.inc + DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result index d5947343967..a16d234b601 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev382.result +++ b/mysql-test/suite/rpl/r/rpl_mdev382.result @@ -355,7 +355,7 @@ a` show binlog events in 'master-bin.000002' from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Gtid 1 # GTID #-#-# -master-bin.000002 # Query 1 # DELETE FROM `db1``; select 'oops!'`.`t``1` +master-bin.000002 # Query 1 # TRUNCATE TABLE `db1``; select 'oops!'`.`t``1` connection slave; include/start_slave.inc connection master; diff --git a/mysql-test/suite/rpl/r/rpl_memory_engine_truncate_on_restart.result b/mysql-test/suite/rpl/r/rpl_memory_engine_truncate_on_restart.result new file mode 100644 index 00000000000..11543e711f9 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_memory_engine_truncate_on_restart.result @@ -0,0 +1,39 @@ +include/master-slave.inc +[connection master] +connection master; +create table t (val int) engine=MEMORY; +# DELETE trigger should never be activated +create trigger tr after delete on t for each row update t2 set val = 1; +insert into t values (1),(2); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# Check pre-restart values +include/diff_tables.inc [master:test.t,slave:test.t] +# Restarting master should empty master and slave `t` +connection master; +include/rpl_restart_server.inc [server_number=1] +connection master; +# Validating MEMORY table on master is empty after restart +# MYSQL_BINLOG datadir/binlog_file --result-file=assert_file +include/assert_grep.inc [Query to truncate the MEMORY table should be the contents of the new event] +# Ensuring slave MEMORY table is empty +connection master; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/diff_tables.inc [master:test.t,slave:test.t] +# Ensure new events replicate correctly +connection master; +insert into t values (3),(4); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# Validate values on slave, after master restart, do not include those inserted previously +include/diff_tables.inc [master:test.t,slave:test.t] +# +# Cleanup +connection master; +drop table t; +include/rpl_end.inc +# End of rpl_memory_engine_truncate_on_restart.test diff --git a/mysql-test/suite/rpl/t/rpl_memory_engine_truncate_on_restart.test b/mysql-test/suite/rpl/t/rpl_memory_engine_truncate_on_restart.test new file mode 100644 index 00000000000..a6e0b39ca85 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_memory_engine_truncate_on_restart.test @@ -0,0 +1,82 @@ +# +# This test ensures that a table with engine=memory is kept consistent with +# the slave when the master restarts. That is, when the master is restarted, it +# should binlog a new TRUNCATE TABLE command for tables with MEMORY engines, +# such that after the slave executes these events, its MEMORY-engine tables +# should be empty. +# +# References: +# MDEV-25607: Auto-generated DELETE from HEAP table can break replication +# +--source include/master-slave.inc + +--connection master +create table t (val int) engine=MEMORY; + +-- echo # DELETE trigger should never be activated +create trigger tr after delete on t for each row update t2 set val = 1; + +insert into t values (1),(2); +--source include/save_master_gtid.inc +--connection slave +--source include/sync_with_master_gtid.inc + +-- echo # Check pre-restart values +--let $diff_tables= master:test.t,slave:test.t +--source include/diff_tables.inc + +--echo # Restarting master should empty master and slave `t` +--connection master +--let $seq_no_before_restart= `SELECT REGEXP_REPLACE(@@global.gtid_binlog_pos, "0-1-", "")` +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +--connection master +--echo # Validating MEMORY table on master is empty after restart +--let $table_size= `select count(*) from t` +if ($table_size) +{ + --echo # MEMORY table is not empty + --die MEMORY table is not empty +} +--let $seq_no_after_restart= `SELECT REGEXP_REPLACE(@@global.gtid_binlog_pos, "0-1-", "")` +if ($seq_no_before_restart == $seq_no_after_restart) +{ + --echo # Event to empty MEMORY table was not binlogged + --die Event to empty MEMORY table was not binlogged +} + +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--let $datadir=`select @@datadir` +--let assert_file= $MYSQLTEST_VARDIR/tmp/binlog_decoded.out +--echo # MYSQL_BINLOG datadir/binlog_file --result-file=assert_file +--exec $MYSQL_BINLOG $datadir/$binlog_file --result-file=$assert_file + +--let assert_text= Query to truncate the MEMORY table should be the contents of the new event +--let assert_count= 1 +--let assert_select= TRUNCATE TABLE +--source include/assert_grep.inc + +--echo # Ensuring slave MEMORY table is empty +--connection master +--source include/save_master_gtid.inc +--connection slave +--source include/sync_with_master_gtid.inc +--source include/diff_tables.inc + +--echo # Ensure new events replicate correctly +--connection master +insert into t values (3),(4); +--source include/save_master_gtid.inc +--connection slave +--source include/sync_with_master_gtid.inc + +--echo # Validate values on slave, after master restart, do not include those inserted previously +--source include/diff_tables.inc + +--echo # +--echo # Cleanup +--connection master +drop table t; +--source include/rpl_end.inc +--echo # End of rpl_memory_engine_truncate_on_restart.test diff --git a/mysys/crc32/crc32_arm64.c b/mysys/crc32/crc32_arm64.c index 6588606a015..0ed671b61e1 100644 --- a/mysys/crc32/crc32_arm64.c +++ b/mysys/crc32/crc32_arm64.c @@ -37,7 +37,7 @@ my_crc32_t crc32c_aarch64_available(void) static unsigned long getauxval(unsigned int key) { unsigned long val; - if (elf_aux_info(key, (void *)&val, (int)sizeof(val) != 0) + if (elf_aux_info(key, (void *)&val, (int)sizeof(val) != 0)) return 0ul; return val; } diff --git a/mysys/crc32/crc32c_x86.cc b/mysys/crc32/crc32c_x86.cc index 6d9169f9384..0a4fd9db812 100644 --- a/mysys/crc32/crc32c_x86.cc +++ b/mysys/crc32/crc32c_x86.cc @@ -264,7 +264,8 @@ static unsigned crc32_avx512(unsigned crc, const char *buf, size_t size, c4 = xor3_512(c4, _mm512_clmulepi64_epi128(l1, b384, 0x10), extract512_128<3>(l1)); - __m256i c2 = _mm512_castsi512_si256(_mm512_shuffle_i64x2(c4, c4, 0b01001110)); + __m256i c2 = + _mm512_castsi512_si256(_mm512_shuffle_i64x2(c4, c4, 0b01001110)); c2 = xor256(c2, _mm512_castsi512_si256(c4)); crc_out = xor128(_mm256_extracti64x2_epi64(c2, 1), _mm256_castsi256_si128(c2)); @@ -289,7 +290,8 @@ static unsigned crc32_avx512(unsigned crc, const char *buf, size_t size, xor3_512(_mm512_clmulepi64_epi128(lo, b384, 1), _mm512_clmulepi64_epi128(lo, b384, 0x10), extract512_128<3>(lo)); - crc512 = xor512(crc512, _mm512_shuffle_i64x2(crc512, crc512, 0b01001110)); + crc512 = + xor512(crc512, _mm512_shuffle_i64x2(crc512, crc512, 0b01001110)); const __m256i crc256 = _mm512_castsi512_si256(crc512); crc_out = xor128(_mm256_extracti64x2_epi64(crc256, 1), _mm256_castsi256_si128(crc256)); @@ -318,7 +320,7 @@ static unsigned crc32_avx512(unsigned crc, const char *buf, size_t size, size += 16; if (size) { get_last_two_xmms: - const __m128i crc2 = crc_out, d = load128(buf + (size - 16)); + const __m128i crc2 = crc_out, d = load128(buf + ssize_t(size) - 16); __m128i S = load128(reinterpret_cast(shuffle128) + size); crc_out = _mm_shuffle_epi8(crc_out, S); S = xor128(S, _mm_set1_epi32(0x80808080)); diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index 8726349daa4..ae2991fc11c 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -103,12 +103,6 @@ #include #include "my_cpu.h" -/* - when using alloca() leave at least that many bytes of the stack - - for functions we might be calling from within this stack frame -*/ -#define ALLOCA_SAFETY_MARGIN 8192 - #define LF_PINBOX_MAX_PINS 65536 static void lf_pinbox_real_free(LF_PINS *pins); @@ -239,26 +233,21 @@ void lf_pinbox_put_pins(LF_PINS *pins) } while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver, (int32*) &top_ver, top_ver-pins->link+nr+LF_PINBOX_MAX_PINS)); - return; } -static int ptr_cmp(const void *pa, const void *pb) +/* + Get the next pointer in the purgatory list. + Note that next_node is not used to avoid the extra volatile. +*/ +#define pnext_node(P, X) (*((void **)(((char *)(X)) + (P)->free_ptr_offset))) + +static inline void add_to_purgatory(LF_PINS *pins, void *addr) { - const void *const*a= pa; - const void *const*b= pb; - return *a < *b ? -1 : *a == *b ? 0 : 1; + pnext_node(pins->pinbox, addr)= pins->purgatory; + pins->purgatory= addr; + pins->purgatory_count++; } -#define add_to_purgatory(PINS, ADDR) \ - do \ - { \ - my_atomic_storeptr_explicit( \ - (void **)((char *)(ADDR)+(PINS)->pinbox->free_ptr_offset), \ - (PINS)->purgatory, MY_MEMORY_ORDER_RELEASE); \ - (PINS)->purgatory= (ADDR); \ - (PINS)->purgatory_count++; \ - } while (0) - /* Free an object allocated via pinbox allocator @@ -276,139 +265,87 @@ void lf_pinbox_free(LF_PINS *pins, void *addr) lf_pinbox_real_free(pins);); } -struct st_harvester { - void **granary; - int npins; +struct st_match_and_save_arg { + LF_PINS *pins; + LF_PINBOX *pinbox; + void *old_purgatory; }; /* - callback forlf_dynarray_iterate: - scan all pins of all threads and accumulate all pins + Callback for lf_dynarray_iterate: + Scan all pins of all threads, for each active (non-null) pin, + scan the current thread's purgatory. If present there, move it + to a new purgatory. At the end, the old purgatory will contain + pointers not pinned by any thread. */ -static int harvest_pins(void *e, void *h) +static int match_and_save(void *e, void *a) { LF_PINS *el= e; - struct st_harvester *hv= h; + struct st_match_and_save_arg *arg= a; + int i; - LF_PINS *el_end= el+MY_MIN(hv->npins, LF_DYNARRAY_LEVEL_LENGTH); + LF_PINS *el_end= el + LF_DYNARRAY_LEVEL_LENGTH; for (; el < el_end; el++) { for (i= 0; i < LF_PINBOX_PINS; i++) { void *p= my_atomic_loadptr((void **)&el->pin[i]); if (p) - *hv->granary++= p; + { + void *cur= arg->old_purgatory; + void **list_prev= &arg->old_purgatory; + while (cur) + { + void *next= pnext_node(arg->pinbox, cur); + + if (p == cur) + { + /* pinned - keeping */ + add_to_purgatory(arg->pins, cur); + /* unlink from old purgatory */ + *list_prev= next; + } + else + list_prev= (void **)((char *)cur+arg->pinbox->free_ptr_offset); + cur= next; + } + if (!arg->old_purgatory) + return 1; + } } } - /* - hv->npins may become negative below, but it means that - we're on the last dynarray page and harvest_pins() won't be - called again. We don't bother to make hv->npins() correct - (that is 0) in this case. - */ - hv->npins-= LF_DYNARRAY_LEVEL_LENGTH; return 0; } -/* - callback forlf_dynarray_iterate: - scan all pins of all threads and see if addr is present there -*/ -static int match_pins(void *e, void *addr) -{ - LF_PINS *el= e; - int i; - LF_PINS *el_end= el+LF_DYNARRAY_LEVEL_LENGTH; - for (; el < el_end; el++) - for (i= 0; i < LF_PINBOX_PINS; i++) - if (my_atomic_loadptr((void **)&el->pin[i]) == addr) - return 1; - return 0; -} - -#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset))) -#define anext_node(X) next_node(&allocator->pinbox, (X)) - /* Scan the purgatory and free everything that can be freed */ static void lf_pinbox_real_free(LF_PINS *pins) { - int npins; - void *list; - void **addr= NULL; - void *first= NULL, *last= NULL; - struct st_my_thread_var *var= my_thread_var; - void *stack_ends_here= var ? var->stack_ends_here : NULL; LF_PINBOX *pinbox= pins->pinbox; - npins= pinbox->pins_in_array+1; - -#ifdef HAVE_ALLOCA - if (stack_ends_here != NULL) - { - int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins; - /* create a sorted list of pinned addresses, to speed up searches */ - if (available_stack_size(&pinbox, stack_ends_here) > - alloca_size + ALLOCA_SAFETY_MARGIN) - { - struct st_harvester hv; - addr= (void **) alloca(alloca_size); - hv.granary= addr; - hv.npins= npins; - /* scan the dynarray and accumulate all pinned addresses */ - lf_dynarray_iterate(&pinbox->pinarray, harvest_pins, &hv); - - npins= (int)(hv.granary-addr); - /* and sort them */ - if (npins) - qsort(addr, npins, sizeof(void *), ptr_cmp); - } - } -#endif - - list= pins->purgatory; - pins->purgatory= 0; + /* Store info about current purgatory. */ + struct st_match_and_save_arg arg = {pins, pinbox, pins->purgatory}; + /* Reset purgatory. */ + pins->purgatory= NULL; pins->purgatory_count= 0; - while (list) + + + lf_dynarray_iterate(&pinbox->pinarray, match_and_save, &arg); + + if (arg.old_purgatory) { - void *cur= list; - list= *(void **)((char *)cur+pinbox->free_ptr_offset); - if (npins) - { - if (addr) /* use binary search */ - { - void **a, **b, **c; - for (a= addr, b= addr+npins-1, c= a+(b-a)/2; (b-a) > 1; c= a+(b-a)/2) - if (cur == *c) - a= b= c; - else if (cur > *c) - a= c; - else - b= c; - if (cur == *a || cur == *b) - goto found; - } - else /* no alloca - no cookie. linear search here */ - { - if (lf_dynarray_iterate(&pinbox->pinarray, match_pins, cur)) - goto found; - } - } - /* not pinned - freeing */ - if (last) - last= next_node(pinbox, last)= (uchar *)cur; - else - first= last= (uchar *)cur; - continue; -found: - /* pinned - keeping */ - add_to_purgatory(pins, cur); + /* Some objects in the old purgatory were not pinned, free them. */ + void *last= arg.old_purgatory; + while (pnext_node(pinbox, last)) + last= pnext_node(pinbox, last); + pinbox->free_func(arg.old_purgatory, last, pinbox->free_func_arg); } - if (last) - pinbox->free_func(first, last, pinbox->free_func_arg); } +#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset))) +#define anext_node(X) next_node(&allocator->pinbox, (X)) + /* lock-free memory allocator for fixed-size objects */ /* diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c index 1503a5db442..bbb53c8ed37 100644 --- a/mysys/my_rdtsc.c +++ b/mysys/my_rdtsc.c @@ -338,7 +338,7 @@ static ulonglong my_timer_init_resolution(ulonglong (*this_timer)(void), static ulonglong my_timer_init_frequency(MY_TIMER_INFO *mti) { int i; - ulonglong time1, time2, time3, time4; + ulonglong time1, time2, time3, time4, denominator; time1= my_timer_cycles(); time2= my_timer_microseconds(); time3= time2; /* Avoids a Microsoft/IBM compiler warning */ @@ -349,7 +349,8 @@ static ulonglong my_timer_init_frequency(MY_TIMER_INFO *mti) } time4= my_timer_cycles() - mti->cycles.overhead; time4-= mti->microseconds.overhead; - return (mti->microseconds.frequency * (time4 - time1)) / (time3 - time2); + denominator = ((time3 - time2) == 0) ? 1 : time3 - time2; + return (mti->microseconds.frequency * (time4 - time1)) / denominator; } /* @@ -602,7 +603,7 @@ void my_timer_init(MY_TIMER_INFO *mti) && mti->microseconds.routine && mti->cycles.routine) { - ulonglong time3, time4; + ulonglong time3, time4, denominator; time1= my_timer_cycles(); time2= my_timer_milliseconds(); time3= time2; /* Avoids a Microsoft/IBM compiler warning */ @@ -612,8 +613,9 @@ void my_timer_init(MY_TIMER_INFO *mti) if (time3 - time2 > 10) break; } time4= my_timer_cycles(); + denominator = ((time4 - time1) == 0) ? 1 : time4 - time1; mti->milliseconds.frequency= - (mti->cycles.frequency * (time3 - time2)) / (time4 - time1); + (mti->cycles.frequency * (time3 - time2)) / denominator; } /* @@ -627,7 +629,7 @@ void my_timer_init(MY_TIMER_INFO *mti) && mti->microseconds.routine && mti->cycles.routine) { - ulonglong time3, time4; + ulonglong time3, time4, denominator; time1= my_timer_cycles(); time2= my_timer_ticks(); time3= time2; /* Avoids a Microsoft/IBM compiler warning */ @@ -641,8 +643,9 @@ void my_timer_init(MY_TIMER_INFO *mti) if (time3 - time2 > 10) break; } time4= my_timer_cycles(); + denominator = ((time4 - time1) == 0) ? 1 : time4 - time1; mti->ticks.frequency= - (mti->cycles.frequency * (time3 - time2)) / (time4 - time1); + (mti->cycles.frequency * (time3 - time2)) / denominator; } } diff --git a/sql/item.cc b/sql/item.cc index 717379e844f..ad76b461847 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -11107,10 +11107,15 @@ bool Item::cleanup_excluding_immutables_processor (void *arg) if (!(get_extraction_flag() == MARKER_IMMUTABLE)) return cleanup_processor(arg); else - { - clear_extraction_flag(); return false; - } +} + + +bool Item::remove_immutable_flag_processor (void *arg) +{ + if (get_extraction_flag() == MARKER_IMMUTABLE) + clear_extraction_flag(); + return false; } diff --git a/sql/item.h b/sql/item.h index b47753e8938..cf13eb82d99 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2197,6 +2197,7 @@ public: virtual bool change_context_processor(void *arg) { return 0; } virtual bool reset_query_id_processor(void *arg) { return 0; } virtual bool is_expensive_processor(void *arg) { return 0; } + bool remove_immutable_flag_processor (void *arg); // FIXME reduce the number of "add field to bitmap" processors virtual bool add_field_to_set_processor(void *arg) { return 0; } diff --git a/sql/opt_range.cc b/sql/opt_range.cc index a37b29f6547..0f54f124297 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -16564,6 +16564,7 @@ static void print_range(String *out, const KEY_PART_INFO *key_part, KEY_MULTI_RANGE *range, uint n_key_parts) { + Check_level_instant_set check_field(current_thd, CHECK_FIELD_IGNORE); uint flag= range->range_flag; String key_name; key_name.set_charset(system_charset_info); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 36bd7ee0af2..70c5b4ffbf6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3045,7 +3045,7 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry) String query(query_buf, sizeof(query_buf), system_charset_info); query.length(0); - query.append(STRING_WITH_LEN("DELETE FROM ")); + query.append(STRING_WITH_LEN("TRUNCATE TABLE ")); append_identifier(thd, &query, &share->db); query.append('.'); append_identifier(thd, &query, &share->table_name); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index bb389c98f3b..b45b9271269 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -11440,6 +11440,19 @@ Item *st_select_lex::pushdown_from_having_into_where(THD *thd, Item *having) goto exit; } } + + /* + Remove IMMUTABLE_FL only after all of the elements of the condition are processed. + */ + it.rewind(); + while ((item=it++)) + { + if (item->walk(&Item::remove_immutable_flag_processor, 0, STOP_PTR)) + { + attach_to_conds.empty(); + goto exit; + } + } exit: thd->lex->current_select= save_curr_select; return having; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4ddf03961bb..2dd88c78c81 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2690,8 +2690,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, DBUG_RETURN(1); lex->query_tables_last= query_tables_last; break; -#endif } +#endif case SCH_PROFILES: /* Mark this current profiling record to be discarded. We don't diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d0afde153b0..790274f46b3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18347,28 +18347,42 @@ static uint innodb_merge_threshold_set_all_debug Force innodb to checkpoint. */ static void -checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void* save) +checkpoint_now_set(THD* thd, st_mysql_sys_var*, void*, const void* save) { - if (*(my_bool*) save) { - mysql_mutex_unlock(&LOCK_global_system_variables); - - lsn_t lsn; - - while (log_sys.last_checkpoint_lsn.load( - std::memory_order_acquire) - + SIZE_OF_FILE_CHECKPOINT - + log_sys.framing_size() - < (lsn= log_sys.get_lsn(std::memory_order_acquire))) { - log_make_checkpoint(); - log_sys.log.flush(); - } - - if (dberr_t err = fil_write_flushed_lsn(lsn)) { - ib::warn() << "Checkpoint set failed " << err; - } - - mysql_mutex_lock(&LOCK_global_system_variables); + if (!*(my_bool*) save) { + return; } + + if (srv_read_only_mode) { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, + "InnoDB doesn't force checkpoint " + "when %s", + (srv_force_recovery + == SRV_FORCE_NO_LOG_REDO) + ? "innodb-force-recovery=6." + : "innodb-read-only=1."); + return; + } + + mysql_mutex_unlock(&LOCK_global_system_variables); + + lsn_t lsn; + + while (log_sys.last_checkpoint_lsn.load( + std::memory_order_acquire) + + SIZE_OF_FILE_CHECKPOINT + + log_sys.framing_size() + < (lsn= log_sys.get_lsn(std::memory_order_acquire))) { + log_make_checkpoint(); + log_sys.log.flush(); + } + + if (dberr_t err = fil_write_flushed_lsn(lsn)) { + ib::warn() << "Checkpoint set failed " << err; + } + + mysql_mutex_lock(&LOCK_global_system_variables); } /****************************************************************//** diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 512794565d4..d241a9b9604 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1788,6 +1788,11 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) _ma_check_print_warning(param, "Number of rows changed from %s to %s", llstr(rows, llbuff), llstr(file->state->records, llbuff2)); + /* + ma_check_print_warning() may generate an error in case of creating keys + for ALTER TABLE. In this case we should signal an error. + */ + error= thd->is_error(); } } else diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index 0abb3f076f5..276703cfaea 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -575,6 +575,7 @@ int ha_s3::create(const char *name, TABLE *table_arg, s3_deinit(s3_client); if (error) maria_delete_table_files(name, 1, 0); + } else #endif /* MOVE_TABLE_TO_S3 */ { diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index e4ba072619b..fb4bc05a863 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2510,7 +2510,7 @@ static int initialize_variables_for_repair(HA_CHECK *param, *info->state= info->s->state.state; if (share->data_file_type == BLOCK_RECORD) share->state.state.data_file_length= MY_ALIGN(sort_info->filelength, - share->block_size); + (my_off_t) share->block_size); else share->state.state.data_file_length= sort_info->filelength; return 0; diff --git a/tests/code_quality/cppcheck_ignorelist.txt b/tests/code_quality/cppcheck_ignorelist.txt index 268bf8108d4..79ee4af563a 100644 --- a/tests/code_quality/cppcheck_ignorelist.txt +++ b/tests/code_quality/cppcheck_ignorelist.txt @@ -1,251 +1,85 @@ -client/mysql.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysql_upgrade.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqladmin.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqlbinlog.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqlcheck.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqlimport.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqlshow.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -client/mysqltest.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -dbug/tests.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -lexyy.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -mysql-test/lib/My/SafeProcess/safe_process_win.cc: error: Uninitialized variable: message_text -mysys/mf_keycache.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_delete.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_fopen.c: error: Return value of allocation function 'freopen' is not stored. -mysys/my_getsystime.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_pread.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_rename.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_winfile.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -mysys/my_write.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -mysys/thr_lock.c: error: There is an unknown macro here somewhere. Configuration is required. If MYSQL_TABLE_WAIT_VARIABLES is a macro then please configure it. -mysys/tree.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -pcre/pcrecpp.cc: warning: Uninitialized variable: kmat -pcre/pcrecpp.h: error: syntax error -pcre/pcregrep.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/audit_null/audit_null.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_ed25519/server_ed25519.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/auth_0x0100.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/dialog_examples.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/qa_auth_interface.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/qa_auth_server.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_examples/test_plugin.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_gssapi/server_plugin.cc: error: syntax error -plugin/auth_gssapi/sspi.h: error: #include nested too deeply -plugin/auth_pam/auth_pam.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_pam/auth_pam_v1.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_pipe/auth_pipe.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/auth_socket/auth_socket.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/aws_key_management/aws_key_management_plugin.cc: error: syntax error -plugin/cracklib_password_check/cracklib_password_check.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/daemon_example/daemon_example.cc: error: syntax error -plugin/debug_key_management/debug_key_management_plugin.cc: error: syntax error -plugin/disks/information_schema_disks.cc: error: syntax error -plugin/example_key_management/example_key_management_plugin.cc: error: syntax error -plugin/feedback/feedback.cc: error: syntax error -plugin/file_key_management/file_key_management_plugin.cc: error: syntax error -plugin/fulltext/plugin_example.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/handler_socket/handlersocket/handlersocket.cpp: error: syntax error -plugin/locale_info/locale_info.cc: error: syntax error -plugin/metadata_lock_info/metadata_lock_info.cc: error: syntax error -plugin/metadata_lock_info/metadata_lock_info.cc: error: syntax error -plugin/qc_info/qc_info.cc: error: syntax error -plugin/query_response_time/plugin.cc: error: syntax error -plugin/query_response_time/query_response_time.cc: error: Array 'm_count[41]' accessed at index 43, which is out of bounds. -plugin/query_response_time/query_response_time.cc: error: Array 'm_total[41]' accessed at index 43, which is out of bounds. -plugin/server_audit/server_audit.c: error: Uninitialized variable: &tm_time -plugin/server_audit/server_audit.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/server_audit/server_audit.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/server_audit/server_audit.c: error: Uninitialized variable: &tm_time -plugin/simple_password_check/simple_password_check.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/sql_errlog/sql_errlog.c: error: Found a exit path from function with non-void return type that has missing return statement -plugin/sql_errlog/sql_errlog.c: error: Uninitialized variable: &t -plugin/user_variables/user_variables.cc: error: syntax error -plugin/userstat/userstat.cc: error: syntax error -plugin/versioning/versioning.cc: error: syntax error -plugin/wsrep_info/plugin.cc: error: syntax error -sql-common/client.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql-common/client_plugin.c: error: va_list 'unused' used before va_start() was called. -sql-common/client_plugin.c: error: va_list 'unused' used before va_start() was called. -sql-common/client_plugin.c: error: va_list 'unused' used before va_start() was called. -sql-common/client_plugin.c: error: va_list 'unused' used before va_start() was called. -sql/debug_sync.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE is a macro then please configure it. -sql/gcalc_slicescan.cc: warning: Possible null pointer dereference: first_bottom_point -sql/gen_lex_hash.cc: error: Common realloc mistake: 'hash_map' nulled but not freed upon failure -sql/handler.h: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql/log.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -sql/log_event.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -sql/log_event_old.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql/net_serv.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql/protocol.h: error: syntax error -sql/rpl_utility.h: error: There is an unknown macro here somewhere. Configuration is required. If CPP_UNNAMED_NS_START is a macro then please configure it. -sql/semisync_slave.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -sql/sql_select.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -sql/sql_string.cc: warning: Iterators to containers from different expressions 'to' and 'from' are used together. -sql/table.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -sql/winservice.c: error: Resource leak: mysql_upgrade_info -sql/wsrep_thd.h: error: failed to expand 'wsrep_create_appliers', Wrong number of parameters for macro 'wsrep_create_appliers'. -storage/archive/azio.c: error: Syntax Error: AST broken, 'if' doesn't have two operands. -storage/archive/ha_archive.cc: error: syntax error -storage/blackhole/ha_blackhole.cc: error: syntax error -storage/cassandra/gen-cpp/Cassandra_server.skeleton.cpp: error: Found a exit path from function with non-void return type that has missing return statement -storage/cassandra/ha_cassandra.cc: error: syntax error -storage/connect/connect.cc: error: Uninitialized variable: lg -storage/connect/domdoc.cpp: error: syntax error -storage/connect/ha_connect.cc: error: syntax error -storage/connect/myconn.cpp: error: Unmatched '{'. Configuration: 'ALPHA;MYSQL_PREPARED_STATEMENTS'. -storage/connect/myconn.cpp: error: Unmatched '{'. Configuration: 'MYSQL_PREPARED_STATEMENTS'. -storage/connect/odbconn.cpp: warning: Uninitialized variable: b -storage/connect/odbconn.cpp: warning: Uninitialized variable: b -storage/connect/odbconn.cpp: warning: Uninitialized variable: b -storage/connect/plugutil.cpp: error: Width 255 given in format string (no. 2) is larger than destination buffer 'stmsg[200]', use %199[^\"] to prevent overflowing it. -storage/connect/plugutil.cpp: error: Width 255 given in format string (no. 1) is larger than destination buffer 'stmsg[200]', use %199[^\"] to prevent overflowing it. -storage/connect/tabjson.cpp: warning: Possible null pointer dereference: Val -storage/connect/tabmul.cpp: error: Uninitialized variable: buf -storage/connect/tabmul.cpp: error: Uninitialized variable: buf -storage/connect/tabmul.cpp: error: Uninitialized variable: buf -storage/connect/taboccur.cpp: warning: Uninitialized variable: *pcrp -storage/connect/unzip.c: warning: Uninitialized variable: *pzlib_filefunc64_32_def.zopen32_file -storage/connect/value.cpp: error: Signed integer overflow for expression 'n*126230400'. -storage/connect/zip.c: warning: Uninitialized variable: *pzlib_filefunc64_32_def.zopen32_file -storage/csv/ha_tina.cc: error: syntax error -storage/example/ha_example.cc: error: syntax error -storage/federated/ha_federated.cc: error: syntax error -storage/heap/ha_heap.cc: error: syntax error -storage/innobase/btr/btr0btr.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/btr/btr0cur.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/btr/btr0defragment.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/btr/btr0sea.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/buf/buf0buf.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/buf/buf0dump.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/buf/buf0flu.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/buf/buf0lru.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/dict/dict0crea.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/dict/dict0dict.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/dict/dict0load.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/dict/dict0stats.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/dict/dict0stats_bg.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/fil/fil0crypt.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/fil/fil0fil.cc: error: syntax error -storage/innobase/fsp/fsp0file.cc: error: Resource leak: file -storage/innobase/fsp/fsp0fsp.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/fts/fts0fts.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/fts/fts0opt.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/fts/fts0que.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/gis/gis0rtree.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/gis/gis0sea.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/handler/ha_innodb.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/handler/handler0alter.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/handler/i_s.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/ibuf/ibuf0ibuf.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/ibuf/ibuf0ibuf.cc: error: failed to expand 'ibuf_bitmap_page_get_bits', Wrong number of parameters for macro 'ibuf_bitmap_page_get_bits'. -storage/innobase/lock/lock0lock.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/lock/lock0wait.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/lock/lock0wait.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/log/log0log.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/log/log0recv.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/os/os0file.cc: error: syntax error -storage/innobase/page/page0page.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/page/page0zip.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/pars/pars0pars.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0ftsort.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0import.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/row/row0ins.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0log.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/row/row0merge.cc: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/innobase/row/row0mysql.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0quiesce.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/row/row0sel.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/row/row0umod.cc: error: There is an unknown macro here somewhere. Configuration is required. If ut_d is a macro then please configure it. -storage/innobase/row/row0upd.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/row/row0vers.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/srv/srv0conc.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ALIGNED is a macro then please configure it. -storage/innobase/srv/srv0srv.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/srv/srv0start.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ATTRIBUTE is a macro then please configure it. -storage/innobase/trx/trx0i_s.cc: error: Array 'table_cache->chunks[39]' accessed at index 39, which is out of bounds. -storage/innobase/trx/trx0i_s.cc: error: Array 'table_cache->chunks[39]' accessed at index 39, which is out of bounds. -storage/innobase/trx/trx0purge.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/trx/trx0rec.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/trx/trx0roll.cc: error: There is an unknown macro here somewhere. Configuration is required. If DECLARE_THREAD is a macro then please configure it. -storage/innobase/trx/trx0trx.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/innobase/trx/trx0undo.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ha_maria.cc: error: syntax error -storage/maria/ma_bitmap.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_blockrec.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_check.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_checkpoint.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_delete.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/maria/ma_delete.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_ft_parser.c: error: Address of local auto-variable assigned to a function parameter. -storage/maria/ma_key.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_loghandler.c: warning: Uninitialized variable: data->current_offset -storage/maria/ma_open.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/maria/ma_pagecache.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_pagecache.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_range.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_recovery_util.c: error: va_start() or va_copy() called subsequently on 'args' without va_end() in between. -storage/maria/ma_rkey.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_rt_index.c: error: failed to expand 'rt_PAGE_END', Wrong number of parameters for macro 'rt_PAGE_END'. -storage/maria/ma_search.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_sp_key.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_update.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/maria/ma_update.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/ma_write.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/maria/ma_write.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/maria/maria_pack.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/ft_parser.c: error: Address of local auto-variable assigned to a function parameter. -storage/myisam/ha_myisam.cc: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_check.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_close.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/myisam/mi_delete.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_key.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_locking.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_open.c: error: There is an unknown macro here somewhere. Configuration is required. If DBUG_EXECUTE_IF is a macro then please configure it. -storage/myisam/mi_range.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_rkey.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_search.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_update.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/mi_write.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisam/myisampack.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -storage/myisammrg/ha_myisammrg.cc: error: syntax error -storage/oqgraph/ha_oqgraph.cc: error: syntax error -storage/perfschema/ha_perfschema.cc: error: syntax error -storage/perfschema/pfs_instr.h: error: Uninitialized variable: m_has_io_stats -storage/perfschema/pfs_instr.h: error: Uninitialized variable: m_has_lock_stats -storage/perfschema/pfs_instr_class.cc: error: There is an unknown macro here somewhere. Configuration is required. If MY_ALIGNED is a macro then please configure it. -storage/perfschema/table_accounts.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esgs_by_account_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esgs_by_host_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esgs_by_user_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esms_by_account_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esms_by_host_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_esms_by_user_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_events_waits.cc: error: Uninitialized struct member: wait.m_wait_class -storage/perfschema/table_events_waits.cc: error: Uninitialized variable: wait -storage/perfschema/table_events_waits.cc: error: Uninitialized struct member: wait.m_wait_class -storage/perfschema/table_ews_by_account_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_ews_by_host_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_ews_by_user_by_event_name.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_hosts.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_setup_actors.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_threads.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/perfschema/table_users.cc: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -storage/sequence/sequence.cc: error: syntax error -storage/test_sql_discovery/test_sql_discovery.cc: error: syntax error -strings/decimal.c: warning: Possible null pointer dereference: to -strings/dump_map.c: error: Array 'fromstat[256]' accessed at index 256, which is out of bounds. -tests/mysql_client_fw.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -tests/thread_test.c: error: There is an unknown macro here somewhere. Configuration is required. If STRINGIFY_ARG is a macro then please configure it. -unittest/mysys/dynstring-t.c: error: syntax error -unittest/mysys/queues-t.c: error: Uninitialized variable: i -unittest/mysys/waiting_threads-t.c: error: Uninitialized variable: m -unittest/mytap/tap.c: error: va_list 'ap' used before va_start() was called. -unittest/mytap/tap.c: error: va_list 'ap' used before va_start() was called. -unittest/mytap/tap.c: error: va_list 'ap' used before va_start() was called. -unittest/mytap/tap.c: error: va_list 'ap' used before va_start() was called. -vio/viosocket.c: error: There is an unknown macro here somewhere. Configuration is required. If MYSQL_SOCKET_WAIT_VARIABLES is a macro then please configure it. -vio/viosocket.c: error: There is an unknown macro here somewhere. Configuration is required. If MYSQL_SOCKET_WAIT_VARIABLES is a macro then please configure it. -vio/viosslfactories.c: error: There is an unknown macro here somewhere. Configuration is required. If ; is a macro then please configure it. -vio/viotest-sslconnect.cc: error: Memory pointed to by 'vio' is freed twice. -vio/viotest-sslconnect.cc: error: Memory pointed to by 'ssl_connector' is freed twice. -wsrep-lib/src/server_state.cpp: error: syntax error: keyword 'try' is not allowed in global scope -wsrep-lib/src/thread_service_v1.cpp: error: Rethrowing current exception with 'throw;', it seems there is no current exception to rethrow. If there is no current exception this calls std::terminate(). More: https://isocpp.org/wiki/faq/exceptions#throw-without-an-object +client/mysqlbinlog.cc ev->output_buf.copy(e->output_buf); warning: Possible null pointer dereference: e +client/mysqldump.c return buff; warning: Uninitialized variable: buff +client/mysqldump.c return buff; warning: Uninitialized variable: buff +include/my_global.h #error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" error: #error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" +include/my_global.h #error WHAT? sizeof(long long) < 8 ??? error: #error WHAT? sizeof(long long) < 8 ??? +include/mysql/psi/mysql_socket.h result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); error: syntax error +include/mysql/psi/mysql_socket.h result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); error: syntax error +include/mysql/psi/psi.h #error "You must include my_global.h in the code for the build to be correct." error: #error "You must include my_global.h in the code for the build to be correct." +mysql-test/lib/My/SafeProcess/safe_process_win.cc |FORMAT_MESSAGE_IGNORE_INSERTS, NULL, last_err , 0, (LPSTR)&message_text, error: Uninitialized variable: message_text +mysys/file_logger.c *l_perm= new_log; error: Uninitialized struct member: new_log.lock +mysys/ma_dyncol.c float8get(store_it_here->x.double_value, data); error: Uninitialized variable: def_temp +mysys/mf_loadpath.c strmake(to, from, FN_REFLEN-1); warning: Uninitialized variable: from +mysys/my_compare.c mi_float4get(f_1,a); error: Uninitialized variable: def_temp +mysys/my_compare.c mi_float4get(f_2,b); error: Uninitialized variable: def_temp +mysys/my_compare.c mi_float8get(d_1,a); error: Uninitialized variable: def_temp +mysys/my_compare.c mi_float8get(d_2,b); error: Uninitialized variable: def_temp +mysys/my_symlink2.c create_link= (linkname && strcmp(abs_linkname,filename)); error: Uninitialized variable: abs_linkname +plugin/sql_errlog/sql_errlog.c (void) localtime_r(&event_time, &t); error: Uninitialized variable: &t +sql-common/client_plugin.c bzero(&unused, sizeof unused); error: va_list 'unused' used before va_start() was called. +sql-common/client_plugin.c plugin= add_plugin(mysql, plugin, 0, 0, unused); error: va_list 'unused' used before va_start() was called. +sql/gen_lex_hash.cc hash_map= (char*)realloc((char*)hash_map,size_hash_map); error: Common realloc mistake: 'hash_map' nulled but not freed upon failure +sql/my_apc.cc apc_calls->prev= qe; error: Non-local variable 'apc_calls->prev' will use pointer to local variable 'apc_request'. +sql/my_apc.cc apc_calls= qe; error: Non-local variable 'apc_calls' will use pointer to local variable 'apc_request'. +sql/sql_string.cc memcpy(dots, STRING_WITH_LEN("...\0")); error: failed to expand 'memcpy', Wrong number of parameters for macro 'memcpy'. +storage/cassandra/gen-cpp/Cassandra_server.skeleton.cpp printf("get_count\n"); error: Found an exit path from function with non-void return type that has missing return statement +storage/connect/connect.cc rcb= valp->SetValue_char(kp, (int)lg); error: Uninitialized variable: lg +storage/connect/connect.cc rcb= valp->SetValue_char((char*)p, (int)lg); error: Uninitialized variable: lg +storage/connect/macutil.cpp #error This is WINDOWS only DLL error: #error This is WINDOWS only DLL +storage/connect/tabjson.cpp Val->SetValue(jsp); warning: Possible null pointer dereference: Val +storage/connect/tabmac.cpp #error This is a WINDOWS only table type error: #error This is a WINDOWS only table type +storage/connect/taboccur.cpp for (i = 0, pcrp = &qrp->Colresp; (crp = *pcrp); ) { warning: Uninitialized variable: *pcrp +storage/connect/tabwmi.cpp #error This is a WINDOWS only table type error: #error This is a WINDOWS only table type +storage/connect/unzip.c us.z_filefunc = *pzlib_filefunc64_32_def; warning: Uninitialized variable: *pzlib_filefunc64_32_def.zopen32_file +storage/connect/value.cpp if ((t -= (n * FOURYEARS)) > 2000000000) error: Signed integer overflow for expression 'n*126230400'. +storage/connect/zip.c ziinit.z_filefunc = *pzlib_filefunc64_32_def; warning: Uninitialized variable: *pzlib_filefunc64_32_def.zopen32_file +storage/federated/ha_federated.cc DBUG_RETURN(retval); error: Uninitialized variable: retval +storage/federatedx/federatedx_pushdown.cc ha_federatedx *h= (ha_federatedx *) table->file; warning: Possible null pointer dereference: table +storage/federatedx/federatedx_pushdown.cc share= get_share(table->s->table_name.str, table); warning: Possible null pointer dereference: table +storage/heap/hp_hash.c float4get(nr, pos); error: Uninitialized variable: def_temp +storage/heap/hp_hash.c float8get(nr, pos); error: Uninitialized variable: def_temp +storage/heap/hp_hash.c float4get(f_1,key); error: Uninitialized variable: def_temp +storage/heap/hp_hash.c float8get(f_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_create.c DBUG_RETURN(my_pwrite(file, buf, sizeof(buf), error: Uninitialized variable: trid_buff +storage/maria/ma_dbug.c mi_float4get(f_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_dbug.c mi_float8get(d_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_ft_parser.c param->mysql_ftparam= &my_param; error: Address of local auto-variable assigned to a function parameter. +storage/maria/ma_key.c float4get(nr,pos); error: Uninitialized variable: def_temp +storage/maria/ma_key.c float8get(nr,pos); error: Uninitialized variable: def_temp +storage/maria/ma_key.c float4get(f_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_key.c float8get(f_1,key); error: Uninitialized variable: def_temp +storage/maria/ma_locking.c write_error= (int) my_pwrite(share->kfile.file, buff, sizeof(buff), error: Uninitialized variable: buff +storage/maria/ma_locking.c (void) my_pwrite(share->kfile.file, buff, sizeof(buff), error: Uninitialized variable: buff +storage/maria/ma_loghandler.c if (! --fc_ptr->counter) warning: Uninitialized variable: fc_ptr +storage/maria/ma_loghandler.c (offset < data->current_offset && warning: Uninitialized variable: data->current_offset +storage/maria/ma_open.c float8get(state->rec_per_key_part[i], ptr); ptr+= 8; error: Uninitialized variable: def_temp +storage/maria/ma_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/maria/ma_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/maria/ma_recovery_util.c va_start(args, format); error: va_start() or va_copy() called subsequently on 'args' without va_end() in between. +storage/maria/ma_search.c if (flag == 0) warning: Uninitialized variable: flag +storage/maria/ma_write.c key->data= key_buff; error: Address of local auto-variable assigned to a function parameter. +storage/maria/tablockman.c mysql_mutex_init(& lm->pool_mutex, MY_MUTEX_INIT_FAST); error: failed to expand 'mysql_mutex_init', Wrong number of parameters for macro 'mysql_mutex_init'. +storage/myisam/ft_parser.c param->mysql_ftparam= &my_param; error: Address of local auto-variable assigned to a function parameter. +storage/myisam/mi_dbug.c mi_float4get(f_1,key); error: Uninitialized variable: def_temp +storage/myisam/mi_dbug.c mi_float8get(d_1,key); error: Uninitialized variable: def_temp +storage/myisam/mi_key.c float4get(nr,pos); error: Uninitialized variable: def_temp +storage/myisam/mi_key.c float8get(nr,pos); error: Uninitialized variable: def_temp +storage/myisam/mi_key.c float4get(f_1,key); error: Uninitialized variable: def_temp +storage/myisam/mi_key.c float8get(f_1,key); error: Uninitialized variable: def_temp +storage/myisam/mi_locking.c write_error= (mysql_file_pwrite(share->kfile, buff, sizeof(buff), error: Uninitialized variable: buff +storage/myisam/mi_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/myisam/mi_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/myisam/mi_open.c return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; error: Uninitialized variable: buff +storage/myisam/mi_search.c if (flag == 0) warning: Uninitialized variable: flag +storage/perfschema/pfs_global.cc return NULL; error: Memory leak: ptr +storage/sequence/sequence.cc maria_declare_plugin(sequence) error: syntax error +strings/decimal.c sanity(to); warning: Possible null pointer dereference: to +strings/dump_map.c if (fromstat[i]) error: Array 'fromstat[256]' accessed at index 256, which is out of bounds. +unittest/mytap/tap.c memset(&ap, 0, sizeof(ap)); error: va_list 'ap' used before va_start() was called. +unittest/mytap/tap.c vemit_tap(pass, NULL, ap); error: va_list 'ap' used before va_start() was called. +unittest/mytap/tap.c memset((char*) &ap, 0, sizeof(ap)); /* Keep compiler happy */ error: va_list 'ap' used before va_start() was called. +unittest/mytap/tap.c vemit_tap(1, NULL, ap); error: va_list 'ap' used before va_start() was called. +vio/viotest-sslconnect.cc delete vio; error: Memory pointed to by 'vio' is freed twice. +vio/viotest-sslconnect.cc delete ssl_connector; error: Memory pointed to by 'ssl_connector' is freed twice. +wsrep-lib/src/server_state.cpp try error: syntax error: keyword 'try' is not allowed in global scope +wsrep-lib/src/thread_service_v1.cpp throw; // Implementation broke the contract and returned. error: Rethrowing current exception with 'throw;', it seems there is no current exception to rethrow. If there is no current exception this calls std::terminate(). More: https://isocpp.org/wiki/faq/exceptions#throw-without-an-object diff --git a/tests/code_quality/flawfinder_ignorelist.json b/tests/code_quality/flawfinder_ignorelist.json index 7b598689693..8c5646153f2 100644 --- a/tests/code_quality/flawfinder_ignorelist.json +++ b/tests/code_quality/flawfinder_ignorelist.json @@ -158,6 +158,62 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/writeengine/shared/we_typeext.h", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 16, + "endColumn": 67, + "snippet": { + "text": " if (fs.chown(fileName.c_str(), uid, gid, funcErrno) == -1)" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "16bbd2ed7b8f86182e8f66980ee23b9e0dfe63a9330b7c16a2c2b81a3e8a9377" + }, + "rank": 1.0 + }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/utils/idbdatafile/PosixFileSystem.cpp", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 18, + "endColumn": 51, + "snippet": { + "text": " if ((ret = ::chown(objectName, p_uid, p_gid)))" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "1882617c363794bedb3e70a4a3be704a3ee928778709b75f971e91ffc7a224b6" + }, + "rank": 1.0 + }, { "ruleId": "FF1033", "level": "error", @@ -214,6 +270,34 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/utils/idbdatafile/PosixFileSystem.cpp", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 22, + "endColumn": 51, + "snippet": { + "text": "int PosixFileSystem::chown(const char* objectName," + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "357c9645f4ff806e824ffc5714887bbfaafe92c4387521d0dec855875c0c21e5" + }, + "rank": 1.0 + }, { "ruleId": "FF1033", "level": "error", @@ -270,6 +354,34 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1035", + "level": "error", + "message": { + "text": "race/readlink:This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./sql/signal_handler.cc", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 13, + "endColumn": 68, + "snippet": { + "text": " if ((len= readlink(\"/proc/self/cwd\", buff, sizeof(buff)-1)) >= 0)" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "4c4d621e451a67f86c3e999e9dd3ceb2639bf4f63b0a946b7836b01d752ca557" + }, + "rank": 1.0 + }, { "ruleId": "FF1010", "level": "error", @@ -298,6 +410,34 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1035", + "level": "error", + "message": { + "text": "race/readlink:This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/primitives/blockcache/fsutils.cpp", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 27, + "endColumn": 79, + "snippet": { + "text": " ssize_t realnamelen = readlink(path.string().c_str(), realname, PATH_MAX);" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "52b685022ce9db6c7c332217d74745fc48b65e3e00f2cfdbde8f858d28b8aa9f" + }, + "rank": 1.0 + }, { "ruleId": "FF1035", "level": "error", @@ -354,6 +494,34 @@ }, "rank": 1.0 }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/utils/idbdatafile/IDBFileSystem.h", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 17, + "endColumn": 46, + "snippet": { + "text": " virtual int chown(const char* objectName," + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "9d9d3ce8ec5fe165af2a81280b5f9cccf73ba9fbb388bc2ffff6abdbdeb37458" + }, + "rank": 1.0 + }, { "ruleId": "FF1033", "level": "error", @@ -410,34 +578,6 @@ }, "rank": 1.0 }, - { - "ruleId": "FF1035", - "level": "error", - "message": { - "text": "race/readlink:This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20)." - }, - "locations": [ - { - "physicalLocation": { - "artifactLocation": { - "uri": "./sql/signal_handler.cc", - "uriBaseId": "SRCROOT" - }, - "region": { - "startColumn": 13, - "endColumn": 66, - "snippet": { - "text": " if ((len= readlink(\"/proc/self/cwd\", buff, sizeof(buff))) >= 0)" - } - } - } - } - ], - "fingerprints": { - "contextHash/v1": "b55a5f3db29b1ce25e12f94e4ea344ed7fb0e63a230cf6b6deb42c28de924457" - }, - "rank": 1.0 - }, { "ruleId": "FF1033", "level": "error", @@ -605,6 +745,62 @@ "contextHash/v1": "e307b1923cc852324e3050b3e4423be7ac4d1d64af274b70b897a85b1cde815f" }, "rank": 1.0 + }, + { + "ruleId": "FF1031", + "level": "error", + "message": { + "text": "race/chown:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/utils/idbdatafile/PosixFileSystem.h", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 9, + "endColumn": 38, + "snippet": { + "text": " int chown(const char* objectName," + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "edadf52c51b65383fbcdec8fcf70136a279635c3c98024e456b364d81f9605f7" + }, + "rank": 1.0 + }, + { + "ruleId": "FF1033", + "level": "error", + "message": { + "text": "race/chmod:This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362)." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "./storage/columnstore/columnstore/versioning/BRM/oidserver.cpp", + "uriBaseId": "SRCROOT" + }, + "region": { + "startColumn": 13, + "endColumn": 93, + "snippet": { + "text": " chmod(fFilename.c_str(), 0664); // XXXPAT: override umask at least for testing" + } + } + } + } + ], + "fingerprints": { + "contextHash/v1": "fab02b6c6609db1b8bb60e7d58130b030d12cced8cf09f8b6ae499171f612a7b" + }, + "rank": 1.0 } ], "externalPropertyFileReferences": {