summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect.result
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2008-01-09 00:40:41 +0300
committerunknown <evgen@moonbone.local>2008-01-09 00:40:41 +0300
commit8845553a81a427bf34ed8466913bc197943a3af6 (patch)
tree927a02087cade37f0b1badec2fd589d545af1a62 /mysql-test/r/subselect.result
parentb8c8ca6845d7fb2b44de03f32e41af5a5ec75a54 (diff)
downloadmariadb-git-8845553a81a427bf34ed8466913bc197943a3af6.tar.gz
Bug#33675: Usage of an uninitialized memory by filesort in a subquery caused
server crash. The filesort implementation has an optimization for subquery execution which consists of reusing previously allocated buffers. In particular the call to the read_buffpek_from_file function might be skipped when a big enough buffer for buffer descriptors (buffpeks) is already allocated. Beside allocating memory for buffpeks this function fills allocated buffer with data read from disk. Skipping it might led to using an arbitrary memory as fields' data and finally to a crash. Now the read_buffpek_from_file function is always called. It allocates new buffer only when necessary, but always fill it with correct data. sql/filesort.cc: Bug#33675: Usage of an uninitialized memory by filesort in a subquery caused server crash.Now the read_buffpek_from_file function is always called. It allocates new buffer only when necessary, but always fill it with correct data. mysql-test/r/subselect.result: Added a test case for the bug#33675: Usage of an uninitialized memory by filesort in a subquery caused server crash. mysql-test/t/subselect.test: Added a test case for the bug#33675: Usage of an uninitialized memory by filesort in a subquery caused server crash.
Diffstat (limited to 'mysql-test/r/subselect.result')
-rw-r--r--mysql-test/r/subselect.result9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index f6487ae3ddf..75df77b0790 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4383,4 +4383,13 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a))' at line 2
DROP TABLE t1,t2;
+create table t1(f11 int, f12 int);
+create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
+insert into t1 values(1,1),(2,2), (3, 3);
+set session sort_buffer_size= 33*1024;
+select count(*) from t1 where f12 =
+(select f22 from t2 where f22 = f12 order by f21 desc, f22, f23 limit 1);
+count(*)
+3
+drop table t1,t2;
End of 5.0 tests.