maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #11837
Re: ddec45aa50e: MDEV-16932: ASAN heap-use-after-free in my_charlen_utf8 / my_well_formed_char_length_utf8 on 2nd execution of SP with ALTER trying to add bad CHECK
Hi, Oleksandr!
On May 20, Oleksandr Byelkin wrote:
> On Mon, May 20, 2019 at 3:11 PM Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
> > On May 20, Oleksandr Byelkin wrote:
> > > revision-id: ddec45aa50e (mariadb-10.2.24-11-gddec45aa50e)
> > > parent(s): 50999738eae
> > > author: Oleksandr Byelkin <sanja@xxxxxxxxxxx>
> > > committer: Oleksandr Byelkin <sanja@xxxxxxxxxxx>
> > > timestamp: 2019-05-14 14:01:15 +0200
> > > message:
> > >
> > > MDEV-16932: ASAN heap-use-after-free in my_charlen_utf8 /
> > > my_well_formed_char_length_utf8 on 2nd execution of SP with ALTER
> > > trying to add bad CHECK
> > >
> > > In case of error the SP can be executed without re-comilation and so
> > > will reuse constructed constaint name, so the name should be allocated
> > > in the statement memory.
> >
> > Is that right? You're saying that the "unique constraint name" will be
> > generated once and reused?
> >
> > But on the second SP invocation is might no longer be unique. I'd think
> > that `ALTER TABLE t1 ADD CONSTRAINT CHECK (x > 0)` should add a new
> > constraint, not "add a new contraint with the name that used to be
> > unique when the SP was invoked for the first time".
>
> With the second call we have 2 possibility:
>
> 1) first execution failed and so we can reuse the name
> 2) first execution succeed and we will re-compile SP or re-prepare PS and
> so will generate new name (that is why we mostly had no problems)
What about this:
CREATE TABLE t1 (a INT);
CREATE PROCEDURE sp() ALTER TABLE t1 ADD CONSTRAINT CHECK (b > 0);
--error ER_BAD_FIELD_ERROR
CALL sp;
alter table t1 add column b int, add constraint check (b < 10);
CALL sp;
?
second CALL will not regenerate the name of the constraint.
Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx
References