[MCOL-5196] REPLACE can provoke invalid capacity assertion in binary processing mode Created: 2022-08-16 Updated: 2023-02-17 Resolved: 2022-09-06 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 5.6.5, 6.4.2 |
| Fix Version/s: | 22.08.1 |
| Type: | Task | Priority: | Major |
| Reporter: | Sergey Zefirov | Assignee: | Sergey Zefirov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
REPLACE('a', 'pqrs', 'b') can provoke invalid length assertion when used with charset that is not multibyte and has MY_CS_BINSORT flag set. This is latin1_bin charset, for one example. The code:
We count number of occurences starting with 1, even if there are no occurences of "fromstring" in the string "str" we are processing. Then we calculate signed integer difference between string to replace to "tostr" and string to replace "fromstring" and multiply it by count of occurences found plus 1. For string to process 'a', string to replace 'pqrs' and string to replace to 'a', the difference will be negative -3, count will be 1 and string to process length is 1. The end result will be a value that is about 4G bytes long or even more. |
| Comments |
| Comment by alexey vorovich (Inactive) [ 2022-08-16 ] | |||||||||
|
drrtuy sergey.zefirov Are we planning to do this for 220801 or later ? | |||||||||
| Comment by Sergey Zefirov [ 2022-08-22 ] | |||||||||
|
Comments contain a link to relevant PR. | |||||||||
| Comment by Daniel Lee (Inactive) [ 2022-09-06 ] | |||||||||
|
Build verified: 22.08 (#5531) Reproduced the issue in 6.4.2 and verified the fix. 6.4.2
22.08
|