1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-30 05:23:50 +03:00

fix use-after-free [closes #89]

This commit is contained in:
kevg
2016-12-10 18:33:40 +03:00
committed by Aleksey Midenkov
parent a17b8f707f
commit 1742561b4e
3 changed files with 12 additions and 15 deletions

View File

@@ -276,7 +276,7 @@ t CREATE TABLE `t` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING ) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
alter table t without system versioning; alter table t without system versioning;
alter table t with system versioning, algorithm=inplace; alter table t with system versioning, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
alter table t with system versioning, algorithm=copy; alter table t with system versioning, algorithm=copy;
show create table t; show create table t;
Table Create Table Table Create Table
@@ -346,7 +346,7 @@ a
2 2
1 1
alter table t without system versioning, algorithm=inplace; alter table t without system versioning, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
alter table t without system versioning, algorithm=copy; alter table t without system versioning, algorithm=copy;
show create table t; show create table t;
Table Create Table Table Create Table

View File

@@ -18,6 +18,7 @@ a b b+0
3 NULL NULL 3 NULL NULL
Warnings: Warnings:
Warning 4075 Attempt to read unversioned field `b` in historical query Warning 4075 Attempt to read unversioned field `b` in historical query
Warning 4075 Attempt to read unversioned field `b` in historical query
select * from t for system_time as of timestamp now(6); select * from t for system_time as of timestamp now(6);
a b a b
1 NULL 1 NULL

View File

@@ -2760,19 +2760,17 @@ void Item_field::set_field(Field *field_par)
if (field->table->s->tmp_table == SYSTEM_TMP_TABLE) if (field->table->s->tmp_table == SYSTEM_TMP_TABLE)
any_privileges= 0; any_privileges= 0;
if (field->flags & VERS_OPTIMIZED_UPDATE_FLAG && context && context->select_lex && field->force_null= false;
context->select_lex->vers_conditions.type != if (field->flags & VERS_OPTIMIZED_UPDATE_FLAG && context &&
FOR_SYSTEM_TIME_UNSPECIFIED && context->select_lex &&
!field->force_null) context->select_lex->vers_conditions.type != FOR_SYSTEM_TIME_UNSPECIFIED)
{ {
DBUG_ASSERT(context->select_lex->parent_lex &&
context->select_lex->parent_lex->thd);
field->force_null= true; field->force_null= true;
THD *thd= context->select_lex->parent_lex->thd; push_warning_printf(
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_NON_VERSIONED_FIELD_IN_VERSIONED_QUERY, ER_NON_VERSIONED_FIELD_IN_VERSIONED_QUERY,
ER_THD(thd, ER_NON_VERSIONED_FIELD_IN_VERSIONED_QUERY), ER_THD(current_thd, ER_NON_VERSIONED_FIELD_IN_VERSIONED_QUERY),
field_name); field_name);
} }
} }
@@ -5922,8 +5920,6 @@ void Item_field::cleanup()
it will be linked correctly next time by name of field and table alias. it will be linked correctly next time by name of field and table alias.
I.e. we can drop 'field'. I.e. we can drop 'field'.
*/ */
if (field)
field->force_null= false;
field= 0; field= 0;
item_equal= NULL; item_equal= NULL;
null_value= FALSE; null_value= FALSE;