diff options
| author | Igor Babaev <igor@askmonty.org> | 2022-03-23 12:45:56 -0700 |
|---|---|---|
| committer | Igor Babaev <igor@askmonty.org> | 2022-03-23 12:50:50 -0700 |
| commit | bbf02c85ba2e850da546199421cb75c224747475 (patch) | |
| tree | 3c3939b83c32fd5977d5911199249031d1ffe377 /sql/sql_view.cc | |
| parent | cade21b4e054486d18db9212e823ea8ce12ea46a (diff) | |
| download | mariadb-git-bbf02c85ba2e850da546199421cb75c224747475.tar.gz | |
MDEV-24281 Reading from freed memory when running main.view with --ps-protocol
This bug could affect prepared statements for the command CREATE VIEW with
specification that contained unnamed basic constant in select list. If
generation of a valid name for the corresponding view column required
resolution of conflicts with names of other columns that were explicitly
defined then execution of such prepared statement and following deallocation
of this statement led to reading from freed memory.
Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql/sql_view.cc')
| -rw-r--r-- | sql/sql_view.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 024bd36f483..b6787a1cb8b 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -96,7 +96,8 @@ static void make_unique_view_field_name(THD *thd, Item *target, itc.rewind(); } - target->orig_name= target->name.str; + if (!target->orig_name) + target->orig_name= target->name.str; target->set_name(thd, buff, name_len, system_charset_info); } |
