diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 7891c737dfd..6bdee3214bc 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -4794,5 +4794,18 @@ c1 c2 2 2 DROP TABLE t1; # +# MDEV-29483 Heap-use-after-free (Binary_string::copy()) with window functions +# +create table t1 (c0 text, c1 int); +insert into t1 values ('a', 1), ('b', 2); +create table t2 (c0 text); +insert into t2 values ('b'); +# Expected: one row 'b' +select coalesce(c0, last_value(c0) over (order by c1)) from (select c0, c1 from t1) dt +where c1 = 0 or c0 in (select c0 from t2); +coalesce(c0, last_value(c0) over (order by c1)) +b +drop table t1, t2; +# # End of 10.11 tests # diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 35f59041d3b..04c9270778c 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -3108,6 +3108,20 @@ from t1; DROP TABLE t1; +--echo # +--echo # MDEV-29483 Heap-use-after-free (Binary_string::copy()) with window functions +--echo # +create table t1 (c0 text, c1 int); +insert into t1 values ('a', 1), ('b', 2); +create table t2 (c0 text); +insert into t2 values ('b'); + +--echo # Expected: one row 'b' +select coalesce(c0, last_value(c0) over (order by c1)) from (select c0, c1 from t1) dt +where c1 = 0 or c0 in (select c0 from t2); + +drop table t1, t2; + --echo # --echo # End of 10.11 tests --echo #