Bug #72685 | LOCATE/INSTR with mixed collations returns inconsistent results | ||
---|---|---|---|
Submitted: | 19 May 2014 20:20 | Modified: | 20 May 2014 6:58 |
Reporter: | Arthur O'Dwyer | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Charsets | Severity: | S2 (Serious) |
Version: | 5.5.31, 5.5.34, 5.6.19, 5.7.5 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[19 May 2014 20:20]
Arthur O'Dwyer
[19 May 2014 22:51]
Arthur O'Dwyer
There's another related bug in LOCATE, obvious from reading the code: If the first argument is the empty string, then we'll skip arg3 *characters* from arg2, but then return the number of *bytes* that we skipped. This is a simple one-character typo in Item_func_locate::val_int(). It returns "start + 1" when the programmer meant to return "start0 + 1". mysql> select locate("","€€€€€€€€€€",11); +------------------------------------------------+ | locate("","€€€€€€€€€€",11) | +------------------------------------------------+ | 31 | +------------------------------------------------+
[20 May 2014 6:58]
MySQL Verification Team
Hello Arthur, Thank you for the bug report and test case. Verified as described. Thanks, Umesh