mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-35230 ASAN errors upon reading from joined temptable views with vector type
fix Field_vector::get_copy_func() for the case when length_bytes differ fix do_copy_vec() to not guess length_bytes but take it from the field (for keys length_bytes is always 2 for any length)
This commit is contained in:
parent
7d081c1b83
commit
053bd80d43
3 changed files with 26 additions and 3 deletions
|
@ -304,3 +304,15 @@ test.t optimize note Table does not support optimize, doing recreate + analyze i
|
|||
test.t optimize status OK
|
||||
insert into t select * from t;
|
||||
drop table t;
|
||||
#
|
||||
# MDEV-35230 ASAN errors upon reading from joined temptable views with vector type
|
||||
#
|
||||
create table t (f vector(1));
|
||||
insert into t values (0x30303030),(0x31313131);
|
||||
create algorithm=temptable view v as select * from t;
|
||||
select v1.f from v v1 natural join v v2;
|
||||
f
|
||||
0000
|
||||
1111
|
||||
drop view v;
|
||||
drop table t;
|
||||
|
|
|
@ -236,3 +236,13 @@ delete from t limit 1;
|
|||
optimize table t;
|
||||
insert into t select * from t;
|
||||
drop table t;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35230 ASAN errors upon reading from joined temptable views with vector type
|
||||
--echo #
|
||||
create table t (f vector(1));
|
||||
insert into t values (0x30303030),(0x31313131);
|
||||
create algorithm=temptable view v as select * from t;
|
||||
select v1.f from v v1 natural join v v2;
|
||||
drop view v;
|
||||
drop table t;
|
||||
|
|
|
@ -243,8 +243,8 @@ int Field_vector::reset()
|
|||
|
||||
static void do_copy_vec(const Copy_field *copy)
|
||||
{
|
||||
uint from_length_bytes= 1 + (copy->from_length > 257);
|
||||
uint to_length_bytes= 1 + (copy->to_length > 257);
|
||||
uint from_length_bytes= static_cast<Field_vector*>(copy->from_field)->length_bytes;
|
||||
uint to_length_bytes= static_cast<Field_vector*>(copy->to_field)->length_bytes;
|
||||
uint from_length= copy->from_length - from_length_bytes;
|
||||
uint to_length= copy->to_length - to_length_bytes;
|
||||
uchar *from= copy->from_ptr + from_length_bytes;
|
||||
|
@ -268,7 +268,8 @@ Field::Copy_func *Field_vector::get_copy_func(const Field *from) const
|
|||
{
|
||||
if (from->type_handler() != &type_handler_vector)
|
||||
return do_field_string;
|
||||
if (field_length == from->field_length)
|
||||
if (field_length == from->field_length &&
|
||||
length_bytes == static_cast<const Field_vector*>(from)->length_bytes)
|
||||
return do_field_eq;
|
||||
return do_copy_vec;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue