1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV-40636 CSV crashes on DELETE

chain_size is the number of tina_set elements, not number of bytes

Assisted-By: Claude:claude-5-opus
This commit is contained in:
Sergei Golubchik
2026-08-05 15:10:15 +02:00
parent d842d6e994
commit 43565b932e
3 changed files with 27 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
#
# MDEV-40636 CSV crashes on DELETE
#
create table t1 (id int not null, pad char(10) not null) engine=csv;
insert t1 select seq,'AAAAAAAAAA' from seq_1_to_2048;
delete from t1 where id % 2 = 0;
select count(*), sum(id) from t1;
count(*) sum(id)
1024 1048576
drop table t1;
# End of 10.6 tests

View File

@@ -0,0 +1,13 @@
--source include/have_csv.inc
--source include/have_sequence.inc
--echo #
--echo # MDEV-40636 CSV crashes on DELETE
--echo #
create table t1 (id int not null, pad char(10) not null) engine=csv;
insert t1 select seq,'AAAAAAAAAA' from seq_1_to_2048;
delete from t1 where id % 2 = 0;
select count(*), sum(id) from t1;
drop table t1;
--echo # End of 10.6 tests

View File

@@ -1,4 +1,5 @@
/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
Copyright (c) 2026, MariaDB plc
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -646,7 +647,8 @@ int ha_tina::chain_append()
if (chain_alloced)
{
if ((chain= (tina_set *) my_realloc(csv_key_memory_tina_set,
(uchar*)chain, chain_size,
(uchar*)chain,
chain_size * sizeof(tina_set),
MYF(MY_WME))) == NULL)
return -1;
}