Commit 5b7c98e
committed
BUG#36314928 - Assertion failure !s.uses_buffer_owned_by(this) in sql_string.cc
BUG#36389091 - `!s.uses_buffer_owned_by(this)' in String::append at sql-common/sql_string.cc
BUG#36397496 - HLL query gives Assertion `!str || str != m_ptr' failed
Problem
=======
In udf_handler::get_and_convert_string, we use udf_handler::buffers
to hold pointers returned by val_str(...) calls. This causes an
issue with certain functions (such as Item_func_concat), which
expect the argument passed in val_str(...) to be non-overlapping
to their local buffers.
Sequence of steps leading to the issue:
1. First call of udf_handler::get_and_convert_string: We call
Item_func_concat::val_str with buffers[0].m_ptr: 0x0.
2. Item_func_concat::val_str returns the address of its local
&tmp_value as res. res->m_ptr: ADDR1
3. We copy *res to buffers[0]. buffers[0].m_ptr: ADDR1
4. Second call of udf_handler::get_and_convert_string: We call
Item_func_concat::val_str with buffers[0].m_ptr: ADDR1
5. Item_func_concat::val_str sees that buffers[0].m_ptr and
its local tmp_value.m_ptr are the same ADDR1 -> assert fails.
Solution
========
- Introduce udf_handler::arg_buffers to hold data returned by
val_str(...) in get_and_convert_string. The current way of
modifying *res itself is risky, since it could be changing
Item::str_value object, which has other implications
(BUG#36297142)
- Instead of using udf_handler::buffers to hold pointers returned,
do a deep copy to udf_handler::arg_buffers.
Change-Id: I50c2a36cd609dc28e70cabe6c730b15bac6ef8d61 parent a032f4a commit 5b7c98e
2 files changed
+16
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4593 | 4593 | | |
4594 | 4594 | | |
4595 | 4595 | | |
| 4596 | + | |
4596 | 4597 | | |
4597 | 4598 | | |
4598 | 4599 | | |
| |||
4703 | 4704 | | |
4704 | 4705 | | |
4705 | 4706 | | |
| 4707 | + | |
| 4708 | + | |
4706 | 4709 | | |
4707 | 4710 | | |
4708 | 4711 | | |
| |||
4723 | 4726 | | |
4724 | 4727 | | |
4725 | 4728 | | |
| 4729 | + | |
4726 | 4730 | | |
4727 | 4731 | | |
4728 | 4732 | | |
| |||
5044 | 5048 | | |
5045 | 5049 | | |
5046 | 5050 | | |
5047 | | - | |
5048 | | - | |
5049 | | - | |
5050 | | - | |
5051 | | - | |
5052 | | - | |
5053 | | - | |
5054 | | - | |
5055 | | - | |
5056 | | - | |
5057 | | - | |
5058 | | - | |
5059 | | - | |
5060 | | - | |
5061 | | - | |
5062 | | - | |
5063 | | - | |
5064 | | - | |
5065 | | - | |
5066 | | - | |
5067 | | - | |
5068 | | - | |
5069 | | - | |
| 5051 | + | |
| 5052 | + | |
| 5053 | + | |
| 5054 | + | |
| 5055 | + | |
| 5056 | + | |
| 5057 | + | |
| 5058 | + | |
| 5059 | + | |
| 5060 | + | |
| 5061 | + | |
5070 | 5062 | | |
5071 | 5063 | | |
5072 | 5064 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
0 commit comments