summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorKaren Langford <karen.langford@oracle.com>2011-05-06 10:03:02 +0200
committerKaren Langford <karen.langford@oracle.com>2011-05-06 10:03:02 +0200
commit74afcca8f23938f0a9fbea78581fd446059f59f9 (patch)
tree21e9deed4059dba183ba20b099bf8e355bdca43e /sql/item_timefunc.cc
parent8cc75b2d1ed70bf794f62f73397b098c47fff01b (diff)
parentb4a59e016b0a1987d9e488ad81a4bad9b8f32d88 (diff)
downloadmariadb-git-74afcca8f23938f0a9fbea78581fd446059f59f9.tar.gz
Merge from mysql-5.1.57-release
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 1044b4682ef..a96922b94a1 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2444,6 +2444,19 @@ String *Item_char_typecast::val_str(String *str)
String *res;
uint32 length;
+ if (cast_length >= 0 &&
+ ((unsigned) cast_length) > current_thd->variables.max_allowed_packet)
+ {
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ cast_cs == &my_charset_bin ?
+ "cast_as_binary" : func_name(),
+ current_thd->variables.max_allowed_packet);
+ null_value= 1;
+ return 0;
+ }
+
if (!charset_conversion)
{
if (!(res= args[0]->val_str(str)))