Commit e19915d5 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-15746 ASAN heap-use-after-free in...

MDEV-15746 ASAN heap-use-after-free in Item_change_list::rollback_item_tree_changes on ALTER executed as PS

10.3+ fix

On ALTER TABLE, if a non-changed column default
might need a charset conversion, it must
be a blob. Because blob's defaults ar stored
as expressions, and for any other type
a basic_const_item() will be in the record,
so it'll have correct charset and won't need
converting. For the same reason it makes no
sense to convert blob defaults (and it's
unsafe, see MDEV-15746).

test case is already in main/ps.test
parent c9717dc0
......@@ -3191,8 +3191,10 @@ bool Column_definition::prepare_stage1_string(THD *thd,
Convert the default value from client character
set into the column character set if necessary.
We can only do this for constants as we have not yet run fix_fields.
But not for blobs, as they will be stored as SQL expressions, not
written down into the record image.
*/
if (default_value &&
if (!(flags & BLOB_FLAG) && default_value &&
default_value->expr->basic_const_item() &&
charset != default_value->expr->collation.collation)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment