mirror of
https://github.com/MariaDB/server.git
synced 2026-05-04 22:25:32 +02:00
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt mysql-test/r/explain.result: Auto merged mysql-test/r/func_default.result: Auto merged mysql-test/r/func_regexp.result: Auto merged mysql-test/r/func_test.result: Auto merged mysql-test/r/having.result: Auto merged mysql-test/r/olap.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/r/varbinary.result: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_strfunc.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_union.cc: Auto merged mysql-test/r/func_str.result: Manually merged mysql-test/t/func_str.test: Manually merged
This commit is contained in:
commit
8a140cb72e
17 changed files with 124 additions and 35 deletions
|
|
@ -964,18 +964,18 @@ String *Item_func_insert::val_str(String *str)
|
|||
args[3]->null_value)
|
||||
goto null; /* purecov: inspected */
|
||||
|
||||
if ((start < 0) || (start > res->length() + 1))
|
||||
if ((start < 0) || (start > res->length()))
|
||||
return res; // Wrong param; skip insert
|
||||
if ((length < 0) || (length > res->length() + 1))
|
||||
length= res->length() + 1;
|
||||
if ((length < 0) || (length > res->length()))
|
||||
length= res->length();
|
||||
|
||||
/* start and length are now sufficiently valid to pass to charpos function */
|
||||
start= res->charpos((int) start);
|
||||
length= res->charpos((int) length, (uint32) start);
|
||||
|
||||
/* Re-testing with corrected params */
|
||||
if (start > res->length() + 1)
|
||||
return res; // Wrong param; skip insert
|
||||
if (start > res->length())
|
||||
return res; /* purecov: inspected */ // Wrong param; skip insert
|
||||
if (length > res->length() - start)
|
||||
length= res->length() - start;
|
||||
|
||||
|
|
@ -1181,11 +1181,10 @@ void Item_func_substr::fix_length_and_dec()
|
|||
if (args[1]->const_item())
|
||||
{
|
||||
int32 start= (int32) args[1]->val_int();
|
||||
start= (int32)((start < 0) ? max_length + start : start - 1);
|
||||
if (start < 0 || start >= (int32) max_length)
|
||||
max_length=0; /* purecov: inspected */
|
||||
if (start < 0)
|
||||
max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start);
|
||||
else
|
||||
max_length-= (uint) start;
|
||||
max_length-= min((uint)(start - 1), max_length);
|
||||
}
|
||||
if (arg_count == 3 && args[2]->const_item())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue