Bug #20447262: REPEATED EXECUTION OF PREPARED STATEMENTS FAILS, IF DEFAULT DATABASE IS CHANGED.
Issue: ====== While re-preparing the statement in Prepared_statement::swap_prepared_statement for swapping the database of PS we only swapped the db string but not its length. This resulted in mismatch between the actual string and its length. In one particular case where db of PS was dropped, we have db as null pointer and length as non-zero. strdup which used above values resulted in invalid memory access. Solution: ========= In Prepared_statement::swap_prepared_statement also swap db_length along with db variable. Also, remove DBUG_ASSERT(db_length == copy->db_length) as this have no meaning if they are 2 different entities.
This commit is contained in:
parent
74a503b4ce
commit
dea2340866
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -3668,8 +3668,8 @@ Prepared_statement::swap_prepared_statement(Prepared_statement *copy)
|
||||
swap_variables(LEX_STRING, name, copy->name);
|
||||
/* Ditto */
|
||||
swap_variables(char *, db, copy->db);
|
||||
swap_variables(size_t, db_length, copy->db_length);
|
||||
|
||||
DBUG_ASSERT(db_length == copy->db_length);
|
||||
DBUG_ASSERT(param_count == copy->param_count);
|
||||
DBUG_ASSERT(thd == copy->thd);
|
||||
last_error[0]= '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user