summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-11-17 17:24:04 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-11-17 17:24:04 +0400
commite072a647d9b98ffbaa606eeee9cad7cde82cd7f3 (patch)
tree09414868bf8403d4a2d0635b409a80c62c644ea3 /sql/item_strfunc.cc
parente7c356f7172cf0451eb4a1723623dfab54b8c3c3 (diff)
downloadmariadb-git-e072a647d9b98ffbaa606eeee9cad7cde82cd7f3.tar.gz
MDEV-6865 Merge Bug#18935421 RPAD DIES WITH CERTAIN PADSTR INTPUTS..
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 66d980fb62d..e7e73794771 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2721,6 +2721,19 @@ String *Item_func_rpad::val_str(String *str)
res->set_charset(&my_charset_bin);
rpad->set_charset(&my_charset_bin);
}
+#if MARIADB_VERSION_ID < 1000000
+ /*
+ Well-formedness is handled on a higher level in 10.0,
+ no needs to check it here again.
+ */
+ else
+ {
+ // This will chop off any trailing illegal characters from rpad.
+ String *well_formed_pad= args[2]->check_well_formed_result(rpad, false);
+ if (!well_formed_pad)
+ goto err;
+ }
+#endif
if (count <= (res_char_length= res->numchars()))
{ // String to pad is big enough
@@ -2826,6 +2839,18 @@ String *Item_func_lpad::val_str(String *str)
res->set_charset(&my_charset_bin);
pad->set_charset(&my_charset_bin);
}
+#if MARIADB_VERSION_ID < 1000000
+ /*
+ Well-formedness is handled on a higher level in 10.0,
+ no needs to check it here again.
+ */ else
+ {
+ // This will chop off any trailing illegal characters from pad.
+ String *well_formed_pad= args[2]->check_well_formed_result(pad, false);
+ if (!well_formed_pad)
+ goto err;
+ }
+#endif
res_char_length= res->numchars();