Commit 5a47bc87 authored by Magne Mahre's avatar Magne Mahre

Merge from 5.1

parents 2152cd95 65032267
...@@ -238,3 +238,6 @@ select a from t1 where a like "abcdefgh ...@@ -238,3 +238,6 @@ select a from t1 where a like "abcdefgh
a a
abcdefgh abcdefgh
drop table t1; drop table t1;
set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators)
using cp1250);
ERROR HY000: Unknown locale: '1'
...@@ -386,6 +386,8 @@ FD FD FD D18D FD ...@@ -386,6 +386,8 @@ FD FD FD D18D FD
FE FE FE D18E FE FE FE FE D18E FE
FF FF FF D18F FF FF FF FF D18F FF
DROP TABLE t1; DROP TABLE t1;
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
ERROR HY000: Unknown locale: '-8388608'
# #
# End of 5.1 tests # End of 5.1 tests
# #
......
...@@ -9859,6 +9859,8 @@ hex(convert(_eucjpms 0xA5FE41 using ucs2)) ...@@ -9859,6 +9859,8 @@ hex(convert(_eucjpms 0xA5FE41 using ucs2))
select hex(convert(_eucjpms 0x8FABF841 using ucs2)); select hex(convert(_eucjpms 0x8FABF841 using ucs2));
hex(convert(_eucjpms 0x8FABF841 using ucs2)) hex(convert(_eucjpms 0x8FABF841 using ucs2))
003F0041 003F0041
set global LC_TIME_NAMES=convert((convert((0x63) using eucjpms)) using utf8);
ERROR HY000: Unknown locale: 'c'
# #
# Start of 5.5 tests # Start of 5.5 tests
# #
......
...@@ -72,3 +72,13 @@ select a from t1 where a like "abcdefgh ...@@ -72,3 +72,13 @@ select a from t1 where a like "abcdefgh
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests
#
# Bug #48053 String::c_ptr has a race and/or does an invalid
# memory reference
# (triggered by Valgrind tests)
# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test)
#
--error 1649
set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators)
using cp1250);
...@@ -65,6 +65,16 @@ DROP TABLE t1; ...@@ -65,6 +65,16 @@ DROP TABLE t1;
--source include/ctype_8bit.inc --source include/ctype_8bit.inc
#
# Bug #48053 String::c_ptr has a race and/or does an invalid
# memory reference
# (triggered by Valgrind tests)
# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test)
#
--error 1649
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
--echo # --echo #
--echo # End of 5.1 tests --echo # End of 5.1 tests
--echo # --echo #
......
...@@ -382,6 +382,16 @@ select hex(convert(_eucjpms 0xA5FE41 using ucs2)); ...@@ -382,6 +382,16 @@ select hex(convert(_eucjpms 0xA5FE41 using ucs2));
select hex(convert(_eucjpms 0x8FABF841 using ucs2)); select hex(convert(_eucjpms 0x8FABF841 using ucs2));
#
# Bug #48053 String::c_ptr has a race and/or does an invalid
# memory reference
# (triggered by Valgrind tests)
# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test)
#
--error 1649
set global LC_TIME_NAMES=convert((convert((0x63) using eucjpms)) using utf8);
--echo # --echo #
--echo # Start of 5.5 tests --echo # Start of 5.5 tests
--echo # --echo #
......
...@@ -113,6 +113,9 @@ public: ...@@ -113,6 +113,9 @@ public:
inline const char *ptr() const { return Ptr; } inline const char *ptr() const { return Ptr; }
inline char *c_ptr() inline char *c_ptr()
{ {
DBUG_ASSERT(!alloced || !Ptr || !Alloced_length ||
(Alloced_length >= (str_length + 1)));
if (!Ptr || Ptr[str_length]) /* Should be safe */ if (!Ptr || Ptr[str_length]) /* Should be safe */
(void) realloc(str_length); (void) realloc(str_length);
return Ptr; return Ptr;
......
...@@ -3082,7 +3082,7 @@ static bool check_locale(sys_var *self, THD *thd, set_var *var) ...@@ -3082,7 +3082,7 @@ static bool check_locale(sys_var *self, THD *thd, set_var *var)
String str(buff, sizeof(buff), system_charset_info), *res; String str(buff, sizeof(buff), system_charset_info), *res;
if (!(res=var->value->val_str(&str))) if (!(res=var->value->val_str(&str)))
return true; return true;
else if (!(locale= my_locale_by_name(res->c_ptr()))) else if (!(locale= my_locale_by_name(res->c_ptr_safe())))
{ {
ErrConvString err(res); ErrConvString err(res);
my_error(ER_UNKNOWN_LOCALE, MYF(0), err.ptr()); my_error(ER_UNKNOWN_LOCALE, MYF(0), err.ptr());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment