Skip to content

Commit

Permalink
MDEV-22608 ASAN use-after-poison in TABLE::check_period_overlaps
Browse files Browse the repository at this point in the history
The bug was fixed by MDEV-22599 bugfix, which changed `Field::cmp` call
to `Field::cmp_prefix` in `TABLE::check_period_overlaps`.

The trick is that `Field_bit::cmp` apparently calls `Field_bit::cmp_key`,
which condiders an argument an actual pointer to data, which isn't correct
for `Field_bit`, since it stores data by `bit_ptr`. which is in the
beginning of the record, and using `ptr` is incorrect (we use it through
`ptr_in_record` call)
  • Loading branch information
FooBarrior committed Nov 2, 2020
1 parent afca976 commit d9e0077
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mysql-test/suite/period/r/overlaps.result
Expand Up @@ -337,4 +337,11 @@ insert into t values (1,'1988-08-25','2024-03-06');
create or replace table t1 (a int) engine=myisam;
insert into t1 values (1),(2);
update t join t1 set s = '2020-01-01';
# MDEV-22608 ASAN use-after-poison in TABLE::check_period_overlaps
create or replace table t1 (s date, e date, b bit, period for p(s,e),
unique(b, p without overlaps)) engine=myisam;
insert into t1 values ('2024-12-21','2034-06-29',0),
('2024-12-21','2034-06-29',1);
update t1 set b = 1;
ERROR 23000: Duplicate entry '\x01-2034-06-29-2024-12-21' for key 'b'
drop table t, t1;
11 changes: 11 additions & 0 deletions mysql-test/suite/period/t/overlaps.test
Expand Up @@ -324,4 +324,15 @@ insert into t1 values (1),(2);

update t join t1 set s = '2020-01-01';


--echo # MDEV-22608 ASAN use-after-poison in TABLE::check_period_overlaps

create or replace table t1 (s date, e date, b bit, period for p(s,e),
unique(b, p without overlaps)) engine=myisam;
insert into t1 values ('2024-12-21','2034-06-29',0),
('2024-12-21','2034-06-29',1);
--error ER_DUP_ENTRY
update t1 set b = 1;


drop table t, t1;

0 comments on commit d9e0077

Please sign in to comment.