Commit 6ffb219
MDEV-32758: TRIM uses memory after freed
Item_func_trim::trimmed_value() prepares Item_func_trim::tmp_value
to be the return value of Item_func_trim::val_str().
Before the fix, tmp_value would have pointer to the trimmed string, but
didn't own it. This meant that second use of TRIM function could get to
point to temporary buffer, then free the buffer and invalidate the return
value of the first use of TRIM().
Avoid this by copying the return value into Item_func_trim::tmp_value.1 parent ce20b2f commit 6ffb219
File tree
3 files changed
+23
-1
lines changed- mysql-test/main
- sql
3 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5421 | 5421 | | |
5422 | 5422 | | |
5423 | 5423 | | |
| 5424 | + | |
| 5425 | + | |
| 5426 | + | |
| 5427 | + | |
| 5428 | + | |
| 5429 | + | |
| 5430 | + | |
| 5431 | + | |
| 5432 | + | |
5424 | 5433 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2455 | 2455 | | |
2456 | 2456 | | |
2457 | 2457 | | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
2458 | 2467 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
766 | | - | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
767 | 771 | | |
768 | 772 | | |
769 | 773 | | |
| |||
0 commit comments