Skip to content

Commit 42dec0e

Browse files
committed
Merge branch 'bb-10.11-release' into bb-11.4-release
2 parents 6eee4e2 + 9654228 commit 42dec0e

34 files changed

Lines changed: 378 additions & 136 deletions

client/mysqltest.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,12 +1541,12 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
15411541
}
15421542
else
15431543
{
1544-
if (!(v= var_get(p, &p, 0, 0)))
1544+
if (!(v= var_get(p, &p, 0, 0)) || !v->str_val)
15451545
{
15461546
report_or_die( "Bad variable in eval");
15471547
DBUG_VOID_RETURN;
15481548
}
1549-
dynstr_append_mem(query_eval, v->str_val, v->str_val_len);
1549+
dynstr_append_mem(query_eval, v->str_val, v->str_val_len);
15501550
}
15511551
break;
15521552
case '\\':
@@ -9284,8 +9284,9 @@ void do_block(enum block_cmd cmd, struct st_command* command)
92849284

92859285
/* Parse and evaluate test expression */
92869286
expr_start= strchr(p, '(');
9287-
if (!expr_start++)
9287+
if (!expr_start)
92889288
die("missing '(' in %s", cmd_name);
9289+
expr_start++;
92899290

92909291
while (my_isspace(charset_info, *expr_start))
92919292
expr_start++;

debian/mariadb-test-data.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
usr/lib/mariadb/plugin/test_pam_modules
12
usr/share/mariadb/mariadb-test/collections
23
usr/share/mariadb/mariadb-test/include
34
usr/share/mariadb/mariadb-test/main

include/my_sys.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
876876
size_t init_alloc,size_t alloc_increment);
877877
extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
878878
my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
879-
size_t length);
879+
size_t length) __attribute__((nonnull(2)));
880880
extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
881881
...);
882882
extern my_bool dynstr_append_quoted(DYNAMIC_STRING *str,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#
2+
# MDEV-4462 mysqld gets SIGFPE when mysql.user table is empty
3+
#
14
create table t1 as select * from mysql.global_priv;
25
truncate table mysql.global_priv;
36
flush privileges;
@@ -14,3 +17,14 @@ connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
1417
connect fail,localhost,u1;
1518
Got one of the listed errors
1619
# switching back from mysql.user to mysql.global_priv
20+
#
21+
# MDEV-39266 Stack Overflow via alloca() in Privilege Table JSON Parser
22+
#
23+
INSERT INTO mysql.global_priv (Host, User, Priv) VALUES
24+
('localhost', 'MDEV-39266', CONCAT(
25+
'{"access":0,"plugin":"mysql_native_password","authentication_string":"',
26+
REPEAT('X', 400000),
27+
'","password_last_changed":0}'));
28+
FLUSH PRIVILEGES;
29+
DROP USER `MDEV-39266`@localhost;
30+
# End if 10.6 tests
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#
2-
# MDEV-4462 mysqld gets SIGFPE when mysql.user table is empty
3-
#
4-
51
source include/not_embedded.inc;
62

3+
--echo #
4+
--echo # MDEV-4462 mysqld gets SIGFPE when mysql.user table is empty
5+
--echo #
6+
77
create table t1 as select * from mysql.global_priv;
88
truncate table mysql.global_priv;
99
flush privileges;
@@ -34,3 +34,17 @@ flush privileges;
3434
connect (fail,localhost,u1);
3535

3636
source include/switch_to_mysql_global_priv.inc;
37+
38+
--echo #
39+
--echo # MDEV-39266 Stack Overflow via alloca() in Privilege Table JSON Parser
40+
--echo #
41+
42+
INSERT INTO mysql.global_priv (Host, User, Priv) VALUES
43+
('localhost', 'MDEV-39266', CONCAT(
44+
'{"access":0,"plugin":"mysql_native_password","authentication_string":"',
45+
REPEAT('X', 400000),
46+
'","password_last_changed":0}'));
47+
FLUSH PRIVILEGES;
48+
DROP USER `MDEV-39266`@localhost;
49+
50+
--echo # End if 10.6 tests

mysql-test/main/case.result

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,c
158158
SHOW CREATE TABLE t1;
159159
Table Create Table
160160
t1 CREATE TABLE `t1` (
161-
`COALESCE(1)` int(1) NOT NULL,
161+
`COALESCE(1)` int(2) NOT NULL,
162162
`COALESCE(1.0)` decimal(2,1) NOT NULL,
163163
`COALESCE('a')` varchar(1) NOT NULL,
164164
`COALESCE(1,1.0)` decimal(2,1) NOT NULL,
@@ -589,4 +589,40 @@ case 'X' when 1/0 then 1 when 'X' then 2 else 3 end
589589
Warnings:
590590
Warning 1292 Truncated incorrect DOUBLE value: 'X'
591591
Warning 1365 Division by 0
592+
#
593+
# MDEV-23278: Incorrect Calculation with AVG() Function
594+
#
595+
create table avg_calc_test (
596+
id int(11) not null auto_increment,
597+
name varchar(255) default null,
598+
primary key (id)
599+
) auto_increment=1 default charset=latin1;
600+
insert into avg_calc_test (name) values ('orange'), ('blue'), ('black'), ('orange'), ('black');
601+
select * from (
602+
select
603+
avg(case when name = 'orange' then 3 when name = 'blue' then 2 when name = 'black' then 1 else 0 end) as metric_val
604+
from avg_calc_test
605+
) t;
606+
metric_val
607+
2.0000
608+
create table t1 as
609+
select
610+
avg(case when name = 'orange' then 3 when name = 'blue' then 2 when name = 'black' then 1 else 0 end) as metric_val
611+
from avg_calc_test;
612+
select * from t1;
613+
metric_val
614+
2.0000
615+
create or replace table t1 as
616+
select
617+
avg(least(1,2)) as metric_val
618+
from avg_calc_test;
619+
select * from t1;
620+
metric_val
621+
1.0000
622+
create or replace table t1 as
623+
select avg(coalesce(1,2)) as metric_val from avg_calc_test;
624+
select * from t1;
625+
metric_val
626+
1.0000
627+
drop table avg_calc_test, t1;
592628
# End of 10.11 test

mysql-test/main/case.test

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,4 +416,41 @@ select case 'X' when null then 1 when 'X' then 2 else 3 end;
416416
select case 'X' when 1/1 then 1 when 'X' then 2 else 3 end;
417417
select case 'X' when 1/0 then 1 when 'X' then 2 else 3 end;
418418

419+
--echo #
420+
--echo # MDEV-23278: Incorrect Calculation with AVG() Function
421+
--echo #
422+
create table avg_calc_test (
423+
id int(11) not null auto_increment,
424+
name varchar(255) default null,
425+
primary key (id)
426+
) auto_increment=1 default charset=latin1;
427+
insert into avg_calc_test (name) values ('orange'), ('blue'), ('black'), ('orange'), ('black');
428+
429+
select * from (
430+
select
431+
avg(case when name = 'orange' then 3 when name = 'blue' then 2 when name = 'black' then 1 else 0 end) as metric_val
432+
from avg_calc_test
433+
) t;
434+
435+
create table t1 as
436+
select
437+
avg(case when name = 'orange' then 3 when name = 'blue' then 2 when name = 'black' then 1 else 0 end) as metric_val
438+
from avg_calc_test;
439+
440+
select * from t1;
441+
442+
create or replace table t1 as
443+
select
444+
avg(least(1,2)) as metric_val
445+
from avg_calc_test;
446+
447+
select * from t1;
448+
449+
create or replace table t1 as
450+
select avg(coalesce(1,2)) as metric_val from avg_calc_test;
451+
452+
select * from t1;
453+
454+
drop table avg_calc_test, t1;
455+
419456
--echo # End of 10.11 test

mysql-test/main/cte_recursive.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5128,7 +5128,7 @@ Warning 1264 Out of range value for column 'mid' at row 5
51285128
show create table t2;
51295129
Table Create Table
51305130
t2 CREATE TABLE `t2` (
5131-
`level` int(1) DEFAULT NULL,
5131+
`level` int(2) DEFAULT NULL,
51325132
`id` int(11) DEFAULT NULL,
51335133
`mid` int(11) DEFAULT NULL,
51345134
`name` text DEFAULT NULL,
@@ -5209,7 +5209,7 @@ Warning 1264 Out of range value for column 'mid' at row 5
52095209
show create table t2;
52105210
Table Create Table
52115211
t2 CREATE TABLE `t2` (
5212-
`level` int(1) DEFAULT NULL,
5212+
`level` int(2) DEFAULT NULL,
52135213
`id` int(11) DEFAULT NULL,
52145214
`mid` int(11) DEFAULT NULL,
52155215
`name` text DEFAULT NULL,

mysql-test/main/ctype_binary.result

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ create table t1 as select concat(least(1,2)) as c1;
607607
show create table t1;
608608
Table Create Table
609609
t1 CREATE TABLE `t1` (
610-
`c1` varbinary(1) DEFAULT NULL
610+
`c1` varbinary(2) DEFAULT NULL
611611
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
612612
drop table t1;
613613
select hex(concat(greatest(1,2)));
@@ -617,7 +617,7 @@ create table t1 as select concat(greatest(1,2)) as c1;
617617
show create table t1;
618618
Table Create Table
619619
t1 CREATE TABLE `t1` (
620-
`c1` varbinary(1) DEFAULT NULL
620+
`c1` varbinary(2) DEFAULT NULL
621621
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
622622
drop table t1;
623623
select hex(concat(case when 11 then 22 else 33 end));
@@ -627,7 +627,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
627627
show create table t1;
628628
Table Create Table
629629
t1 CREATE TABLE `t1` (
630-
`c1` varbinary(2) DEFAULT NULL
630+
`c1` varbinary(3) DEFAULT NULL
631631
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
632632
drop table t1;
633633
select hex(concat(coalesce(1,2)));
@@ -637,7 +637,7 @@ create table t1 as select concat(coalesce(1,2)) as c1;
637637
show create table t1;
638638
Table Create Table
639639
t1 CREATE TABLE `t1` (
640-
`c1` varbinary(1) DEFAULT NULL
640+
`c1` varbinary(2) DEFAULT NULL
641641
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
642642
drop table t1;
643643
select hex(concat_ws(1,2,3));
@@ -1068,7 +1068,7 @@ create table t1 as select concat(ifnull(1,1)) as c1;
10681068
show create table t1;
10691069
Table Create Table
10701070
t1 CREATE TABLE `t1` (
1071-
`c1` varbinary(1) DEFAULT NULL
1071+
`c1` varbinary(2) DEFAULT NULL
10721072
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
10731073
drop table t1;
10741074
select hex(concat(ifnull(1.1,1.1)));
@@ -1108,7 +1108,7 @@ create table t1 as select concat(if(1,1,1)) as c1;
11081108
show create table t1;
11091109
Table Create Table
11101110
t1 CREATE TABLE `t1` (
1111-
`c1` varbinary(1) DEFAULT NULL
1111+
`c1` varbinary(2) DEFAULT NULL
11121112
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
11131113
drop table t1;
11141114
select hex(concat(nullif(1,2)));

mysql-test/main/ctype_cp1251.result

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ create table t1 as select concat(least(1,2)) as c1;
10191019
show create table t1;
10201020
Table Create Table
10211021
t1 CREATE TABLE `t1` (
1022-
`c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
1022+
`c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
10231023
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
10241024
drop table t1;
10251025
select hex(concat(greatest(1,2)));
@@ -1029,7 +1029,7 @@ create table t1 as select concat(greatest(1,2)) as c1;
10291029
show create table t1;
10301030
Table Create Table
10311031
t1 CREATE TABLE `t1` (
1032-
`c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
1032+
`c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
10331033
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
10341034
drop table t1;
10351035
select hex(concat(case when 11 then 22 else 33 end));
@@ -1039,7 +1039,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
10391039
show create table t1;
10401040
Table Create Table
10411041
t1 CREATE TABLE `t1` (
1042-
`c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
1042+
`c1` varchar(3) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
10431043
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
10441044
drop table t1;
10451045
select hex(concat(coalesce(1,2)));
@@ -1049,7 +1049,7 @@ create table t1 as select concat(coalesce(1,2)) as c1;
10491049
show create table t1;
10501050
Table Create Table
10511051
t1 CREATE TABLE `t1` (
1052-
`c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
1052+
`c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
10531053
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
10541054
drop table t1;
10551055
select hex(concat_ws(1,2,3));
@@ -1480,7 +1480,7 @@ create table t1 as select concat(ifnull(1,1)) as c1;
14801480
show create table t1;
14811481
Table Create Table
14821482
t1 CREATE TABLE `t1` (
1483-
`c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
1483+
`c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
14841484
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
14851485
drop table t1;
14861486
select hex(concat(ifnull(1.1,1.1)));
@@ -1520,7 +1520,7 @@ create table t1 as select concat(if(1,1,1)) as c1;
15201520
show create table t1;
15211521
Table Create Table
15221522
t1 CREATE TABLE `t1` (
1523-
`c1` varchar(1) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
1523+
`c1` varchar(2) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL
15241524
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
15251525
drop table t1;
15261526
select hex(concat(nullif(1,2)));

0 commit comments

Comments
 (0)