The crash happens because of incorrect max_length calculation
in QUOTE function(due to overflow). max_length is set
to 0 and it leads to assert failure.
The fix is to cast expression result to
ulonglong variable and adjust it if the
result exceeds MAX_BLOB_WIDTH.
mysql-test/r/func_str.result:
test case
mysql-test/t/func_str.test:
test case
sql/item_strfunc.h:
cast expression result to ulonglong variable and
adjust it if the result exceeds MAX_BLOB_WIDTH.
The problem was that the multiple evaluations of a ENCODE or
DECODE function within a single statement caused the random
generator to be reinitialized at each evaluation, even though
the parameters were constants.
The solution is to initialize the random generator only once
if the password (seed) parameter is constant.
This patch borrows code and ideas from Georgi Kodinov's patch.
mysql-test/r/func_str.result:
Add test case result.
mysql-test/r/ps.result:
Add test case result.
mysql-test/t/func_str.test:
Add test case for Bug#49141
mysql-test/t/ps.test:
Add test case for Bug#49141
sql/item_strfunc.cc:
Move seed generation code to a separate method.
Seed only once if the password (seed) argument
is constant.
Remove duplicated code and use a transform method
to apply encoding or decoding.
sql/item_strfunc.h:
Add parameter to signal whether the PRNG is already seeded.
Introduce transform method.
Combine val_str methods.
sql/sql_crypt.cc:
Remove method.
sql/sql_crypt.h:
Seed is supplied as two long integers.
The problem is that argument buffer can be used as result buffer
and it leads to argument value change.
The fix is to use 'old buffer' as result buffer only
if first argument is not constant item.
mysql-test/r/func_str.result:
test result
mysql-test/t/func_str.test:
test case
sql/item_strfunc.cc:
The problem is that argument buffer can be used as result buffer
and it leads to argument value change.
The fix is to use 'old buffer' as result buffer only
if first argument is not constant item.
Problem: using LOAD_FILE() in some cases we pass a file name string
without a trailing '\0' to fn_format() which relies on that however.
That may lead to valgrind warnings.
Fix: add a trailing '\0' to the file name passed to fn_format().
mysql-test/r/func_str.result:
Fix for bug#44774: load_file function produces valgrind warnings
- test result.
mysql-test/t/func_str.test:
Fix for bug#44774: load_file function produces valgrind warnings
- test case.
sql/item_strfunc.cc:
Fix for bug#44774: load_file function produces valgrind warnings
- passing a file name to fn_format(), file_name->c_ptr() replaced
with file_name->c_ptr_safe() to ensure we have a trailing '\0'.
The warning happens because string argument is not zero ended.
The fix is to add new parameter 'length' to SQL_CRYPT() and
use ptr() instead of c_ptr().
mysql-test/r/func_str.result:
test result
mysql-test/t/func_str.test:
test case
sql/item_strfunc.cc:
Added new parameter 'length' to SQL_CRYPT
sql/sql_crypt.cc:
Added new parameter 'length' to SQL_CRYPT
sql/sql_crypt.h:
Added new parameter 'length' to SQL_CRYPT
date_format functions
String::realloc() did not check whether the existing string data fits in
the newly allocated buffer for cases when reallocating a String object
with external buffer (i.e.alloced == FALSE). This could lead to memory
overruns in some cases.
client/sql_string.cc:
Fixed String::realloc() to check whether the existing string data fits
in the newly allocated buffer for cases when reallocating a String
object with external buffer.
mysql-test/r/func_str.result:
Added a test case for bug #41868.
mysql-test/t/func_str.test:
Added a test case for bug #41868.
sql/sql_class.cc:
After each call to Item::send() in select_send::send_data() reset
buffer to its original state to reduce unnecessary malloc() calls. See
comments for bug #41868 for detailed analysis.
sql/sql_string.cc:
Fixed String::realloc() to check whether the existing string data fits
in the newly allocated buffer for cases when reallocating a String
object with external buffer.
functions
String::realloc() did not check whether the existing string data fits in the newly
allocated buffer for cases when reallocating a String object with external buffer
(i.e.alloced == FALSE). This could lead to memory overruns in some cases.
mysql-test/r/func_str.result:
Added a test case for bug #41868.
mysql-test/t/func_str.test:
Added a test case for bug #41868.
sql/sql_class.cc:
After each call to Item::send() in select_send::send_data() reset buffer to its
original state to reduce unnecessary malloc() calls. See comments for bug #41868
for detailed analysis.
sql/sql_string.cc:
Fixed String::realloc() to check whether the existing string data fits in the newly allocated buffer for cases when reallocating a String object with external buffer.
mysql-test/r/myisam_data_pointer_size_func.result:
restore default value
mysql-test/r/partition_datatype.result:
test case fix
mysql-test/t/myisam_data_pointer_size_func.test:
restore default value
the problem: FORMAT func max_length value was calculated incorrectly
the fix: correct calculation of max_length
mysql-test/r/func_str.result:
test result
mysql-test/t/func_str.test:
test case
sql/item_strfunc.h:
the problem: FORMAT func max_length value was calculated incorrectly
the fix: correct calculation of max_length
In BENCHMARK(count, expr), count could overflow/wrap-around.
Patch changes to a sufficiently large data-type. Adds a warning
for negative count values.
mysql-test/r/func_str.result:
show that a negative 'count' for BENCHMARK(count, expr)
throws a warning and returns NULL.
mysql-test/t/func_str.test:
show that a negative 'count' for BENCHMARK(count, expr)
throws a warning and returns NULL.
sql/item_func.cc:
use ulonglong rather than ulong in BENCHMARK(count, expr)
throw warning on negative 'count'; return SQL-NULL.
into mysql.com:/home/hf/work/31758/my51-31758
mysql-test/t/func_str.test:
Auto merged
sql/item_strfunc.h:
Auto merged
mysql-test/r/func_str.result:
merging
into mysql.com:/home/hf/work/31758/my50-31758
mysql-test/t/func_str.test:
Auto merged
mysql-test/r/func_str.result:
merging
sql/item_strfunc.h:
merging
Item_func_inet_ntoa and Item_func_conv inherit 'maybe_null' flag from an
argument, which is wrong.
Both can be NULL with notnull arguments, so that's fixed.
mysql-test/r/func_str.result:
Bug #31758 inet_ntoa, oct crashes server with null+filesort
test case
mysql-test/t/func_str.test:
Bug #31758 inet_ntoa, oct crashes server with null+filesort
test result
sql/item_strfunc.h:
Bug #31758 inet_ntoa, oct crashes server with null+filesort
missing maybe_null flags set for Item_func_inet_ntoa and Item_func_conv
into polly.(none):/home/kaa/src/opt/bug28550/my51-bug28550
mysql-test/t/func_str.test:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_strfunc.h:
Auto merged
mysql-test/r/func_str.result:
Manual merge.
Since, as of MySQL 5.0.15, CHAR() arguments larger than 255 are converted into multiple result bytes, a single CHAR() argument can now take up to 4 bytes. This patch fixes Item_func_char::fix_length_and_dec() to take this into account.
This patch also fixes a regression introduced by the patch for bug21513. As now we do not always have the 'name' member of Item set for Item_hex_string and Item_bin_string, an own print() method has been added to Item_hex_string so that it could correctly be printed by Item_func::print_args().
mysql-test/r/func_str.result:
Import patch bug288550.patch
mysql-test/t/func_str.test:
Import patch bug288550.patch
sql/item.cc:
Import patch bug288550.patch
sql/item.h:
Import patch bug288550.patch
sql/item_strfunc.h:
Import patch bug288550.patch
into gleb.loc:/home/uchum/work/bk/5.1-opt
mysql-test/r/func_str.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
sql/item_strfunc.cc:
Auto merged
represented by an expression of the type UNSIGNED INT and this
expression was evaluated to 0 then the function erroneously returned
the value of the first argument instead of an empty string.
This problem was introduced by the patch for bug 10963.
The problem has been resolved by a proper modification of the code of
Item_func_substr::val_str.
mysql-test/r/func_str.result:
Added a test case for bug #27130.
mysql-test/t/func_str.test:
Added a test case for bug #27130.
into gleb.loc:/home/uchum/work/bk/5.1-opt
mysql-test/r/func_str.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
mysql-test/r/bigint.result:
Merge with 5.0-opt.
mysql-test/t/bigint.test:
Merge with 5.0-opt.
sql/item_func.cc:
Merge with 5.0-opt.
of its arguments was evaluated to NULL, while the predicate
LOCATE(str,NULL) IS NULL erroneously was evaluated to FALSE.
This happened because the Item_func_locate::fix_length_and_dec
method by mistake set the value of the maybe_null flag for
the function item to 0. In consequence of this the function
was considered as the one that could not ever return NULL.
mysql-test/r/func_str.result:
Added a test case for bug #27932.
mysql-test/t/func_str.test:
Added a test case for bug #27932.
into moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt
mysql-test/r/func_str.result:
Auto merged
mysql-test/r/key.result:
Auto merged
mysql-test/r/row.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/subselect3.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
mysql-test/t/key.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/item_subselect.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_view.cc:
Auto merged
mysql-test/t/view.test:
Manually merged
sql/sql_lex.h:
Manually merged
The function CRC32() returns unsigned integer.
But the metadata (the unsigned flag) for the
function was set incorrectly.
As a result type arithmetics based on the
function's metadata (like finding the concise
type of an temporary table column to hold the result)
returned incorrect results.
Fixed by returning correct type information.
This fix is based on code contributed by Martin Friebe
(martin@hybyte.com) on 2007-03-30.
mysql-test/r/func_str.result:
Bug #27530: test case
mysql-test/t/func_str.test:
Bug #27530: test case
sql/item_strfunc.h:
Bug #27530: Marked CRC32() as returning unsigned
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
mysql-test/r/func_str.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
sql/item_strfunc.cc:
Auto merged
into pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
mysql-test/r/func_str.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
sql/item_strfunc.cc:
Auto merged
into pilot.blaudden:/home/msvensson/mysql/bug25197/my51-bug25197
mysql-test/r/func_str.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
sql/item_strfunc.cc:
Auto merged
- Add extra test case from bug#27073
- Change "if" to be optimized for count > 0
mysql-test/r/func_str.result:
Add test case from bug#27073
mysql-test/t/func_str.test:
Add test case from bug#27073
sql/item_strfunc.cc:
Change the if statemnet to be optimized for the normal case where count > 0
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
When the SUBSTRING() function was used over a LONGTEXT field the max_length of
the SUBSTRING() result was wrongly calculated and set to 0. As the max_length
parameter is used while tmp field creation it limits the length of the result
field and leads to printing an empty string instead of the correct result.
Now the Item_func_substr::fix_length_and_dec() function correctly calculates
the max_length parameter.
mysql-test/t/func_str.test:
Added a test case for the bug#15757: Wrong SUBSTRING() result when a tmp table was employed.
mysql-test/r/func_str.result:
Added a test case for the bug#15757: Wrong SUBSTRING() result when a tmp table was employed.
sql/item_strfunc.cc:
Bug#15757: Wrong SUBSTRING() result when a tmp table was employed.
Now the Item_func_substr::fix_length_and_dec() function correctly calculates
the max_length parameter.
into magare.gmz:/home/kgeorge/mysql/autopush/B26281-5.0-opt
sql/item_strfunc.cc:
Auto merged
mysql-test/r/func_str.result:
resolved test merge conflicts
mysql-test/t/func_str.test:
resolved test merge conflicts
Fixed boundry checks in the INSERT() function:
were one off.
mysql-test/r/func_str.result:
Bug #26281: test case
mysql-test/t/func_str.test:
Bug #26281: test case
sql/item_strfunc.cc:
Bug #26281: fixed boundry checks
into mysql.com:/home/hf/work/mrg/mysql-5.1-opt
mysql-test/r/order_by.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/order_by.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/func_str.result:
merging
mysql-test/r/sp.result:
merging
mysql-test/r/view.result:
merging
mysql-test/t/func_str.test:
merging
mysql-test/t/view.test:
merging
into mysql.com:/home/hf/work/mrg/mysql-5.0-opt
mysql-test/r/order_by.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/order_by.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/func_str.result:
merging
mysql-test/r/sp.result:
merging
mysql-test/r/view.result:
merging
mysql-test/t/func_str.test:
merging
mysql-test/t/view.test:
merging
into mysql.com:/home/hf/work/mrg/mysql-5.1-opt
BUILD/check-cpu:
Auto merged
mysql-test/r/explain.result:
Auto merged
mysql-test/r/func_str.result:
Auto merged
mysql-test/r/func_test.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/update.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/explain.test:
Auto merged
mysql-test/t/func_str.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.h:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/func_in.result:
SCCS merged
mysql-test/r/order_by.result:
SCCS merged
mysql-test/r/sp.result:
merging
mysql-test/t/func_in.test:
SCCS merged
mysql-test/t/order_by.test:
SCCS merged
mysql-test/t/view.test:
merging
sql/item_cmpfunc.h:
merging
sql/mysql_priv.h:
merging
sql/sql_select.cc:
SCCS merged
to return NULL for non-NULL arguments.
This is not the case as it can return NULL
for invalid hexidecimal strings.
Fixed by setting the maybe_null flag.
mysql-test/r/func_str.result:
Bug #26537: test case
mysql-test/t/func_str.test:
Bug #26537: test case
sql/item_strfunc.h:
Bug #26537: item_unhex() can return NULLs
even for guaranteed non-null arguments.
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
mysql-test/r/func_str.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
sql/item_strfunc.cc:
Auto merged
- Return empty string also if count is unsigned and value is 0
mysql-test/r/func_str.result:
Update test result
mysql-test/t/func_str.test:
Add test case for using an unsigned value as count parameter
for REPEAT
sql/item_strfunc.cc:
The repeat function should return the emptystring if
count is unsigned and equal to zero or
count is signed and less than or equal to zero
into macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt
mysql-test/r/func_in.result:
Auto merged
mysql-test/r/range.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/sp-code.result:
Auto merged
mysql-test/r/trigger.result:
Auto merged
mysql-test/r/udf.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/func_in.test:
Auto merged
mysql-test/t/func_str.test:
Auto merged
mysql-test/t/range.test:
Auto merged
mysql-test/t/select.test:
Auto merged
mysql-test/t/trigger.test:
Auto merged
mysql-test/t/udf.test:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_range.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_union.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/func_str.result:
merge 5.0-opt -> 5.1-opt
mysql-test/r/group_by.result:
merge 5.0-opt -> 5.1-opt
mysql-test/r/insert.result:
merge 5.0-opt -> 5.1-opt
mysql-test/r/subselect.result:
merge 5.0-opt -> 5.1-opt
mysql-test/t/group_by.test:
merge 5.0-opt -> 5.1-opt
mysql-test/t/insert.test:
merge 5.0-opt -> 5.1-opt
mysql-test/t/subselect.test:
merge 5.0-opt -> 5.1-opt
mysql-test/t/view.test:
merge 5.0-opt -> 5.1-opt
sql/item_cmpfunc.h:
merge 5.0-opt -> 5.1-opt
sql/item_strfunc.h:
merge 5.0-opt -> 5.1-opt
into moonbone.local:/work/latest-5.0-opt-mysql
mysql-test/t/func_str.test:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/sql_delete.cc:
Auto merged
mysql-test/r/delete.result:
Manual merge
mysql-test/r/func_str.result:
Manual merge
mysql-test/t/delete.test:
Manual merge
correctly.
The Item_func::print method was used to print the Item_func_encode and the
Item_func_decode objects. The last argument to ENCODE and DECODE functions
is a plain C string and thus Item_func::print wasn't able to print it.
The print() method is added to the Item_func_encode class. It correctly
prints the Item_func_encode and the Item_func_decode objects.
mysql-test/t/func_str.test:
Added a test case for bug#23409: Arguments of the ENCODE() and the
> DECODE() functionswere not printed correctly.
mysql-test/r/func_str.result:
Added a test case for bug#23409: Arguments of the ENCODE() and the DECODE() functions were not printed correctly.
sql/item_strfunc.h:
Bug#23409: Arguments of the ENCODE() and the DECODE() functions were not printed correctly.
The print() method is added to the Item_func_encode class.
sql/item_strfunc.cc:
Bug#23409: Arguments of the ENCODE() and the DECODE() functions were not printed correctly.
The print() method is added to the Item_func_encode class. It correctly
prints the Item_func_encode and the Item_func_decode objects.
Handling of large signed/unsigned values was not consistent, so some string functions could return bogus results.
The current fix is to simply patch up the val_str() methods for those string items.
It would be good clean this code up in general, to make similar problems much harder to make. This is left as an exercise for the reader.
mysql-test/r/func_str.result:
Update test results for bug #24947
mysql-test/t/func_str.test:
Add test case for bug #24947
sql/item_strfunc.cc:
Adjust some string function Items' val_str() methods to handle large signed/unsigned arguments properly
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
libmysql/libmysql.c:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
mysql-test/lib/mtr_io.pl:
Auto merged
mysql-test/r/im_daemon_life_cycle.result:
Auto merged
mysql-test/r/im_life_cycle.result:
Auto merged
mysql-test/r/rpl_trigger.result:
Auto merged
mysql-test/r/trigger.result:
Auto merged
mysql-test/t/im_daemon_life_cycle.imtest:
Auto merged
mysql-test/t/im_life_cycle.imtest:
Auto merged
mysql-test/t/im_utils.imtest:
Auto merged
mysql-test/t/rpl_trigger.test:
Auto merged
mysql-test/t/trigger.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/lib/mtr_process.pl:
Use local.
mysql-test/r/func_str.result:
SCCS merged
mysql-test/t/func_str.test:
Manual merge.
sql/sql_trigger.cc:
Manual merge.
sql/sql_yacc.yy:
Manual merge.
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
libmysql/libmysql.c:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
mysql-test/t/ps.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
server-tools/instance-manager/mysql_connection.cc:
Rollback Monty's removals of explicit casts
tests/mysql_client_test.c:
SCCS merged