summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <gluh@mysql.com/eagle.(none)>2007-10-15 18:40:58 +0500
committerunknown <gluh@mysql.com/eagle.(none)>2007-10-15 18:40:58 +0500
commit048006e2f9a4cc0ffd39eb160c6810ae84e78328 (patch)
tree912b4fe0b217bd89dd58ad43d1df0a6fdf553297 /sql/item.cc
parentf30eacb223f581ece4bce02b3c4dfac1310f9f72 (diff)
downloadmariadb-git-048006e2f9a4cc0ffd39eb160c6810ae84e78328.tar.gz
Bug#30986 Character set introducer followed by a HEX string can return bad result(addon)
issue an error if string has illegal characters mysql-test/r/ctype_utf8.result: issue an error if string has illegal characters mysql-test/t/ctype_utf8.test: issue an error if string has illegal characters sql/item.cc: issue an error if string has illegal characters sql/item.h: issue an error if string has illegal characters sql/sql_yacc.yy: issue an error if string has illegal characters
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc
index b4d1e1e2f52..bc626aae999 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4247,7 +4247,7 @@ bool Item::is_datetime()
}
-String *Item::check_well_formed_result(String *str)
+String *Item::check_well_formed_result(String *str, bool send_error)
{
/* Check whether we got a well-formed string */
CHARSET_INFO *cs= str->charset();
@@ -4263,8 +4263,14 @@ String *Item::check_well_formed_result(String *str)
uint diff= str->length() - wlen;
set_if_smaller(diff, 3);
octet2hex(hexbuf, str->ptr() + wlen, diff);
- if (thd->variables.sql_mode &
- (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))
+ if (send_error)
+ {
+ my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
+ cs->csname, hexbuf);
+ return 0;
+ }
+ if ((thd->variables.sql_mode &
+ (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
{
level= MYSQL_ERROR::WARN_LEVEL_ERROR;
null_value= 1;