summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-04-06 09:13:49 +0400
committerAlexander Barkov <bar@mariadb.org>2016-04-06 09:13:49 +0400
commitd516a2ae0cbd09d3b5b1667ec62b421330ab9902 (patch)
tree8180665f03dcf47a233a56346f2724cfa141a93f /strings
parentbddd63cfbaa5dba96e934166a2a234e13e20db4b (diff)
downloadmariadb-git-d516a2ae0cbd09d3b5b1667ec62b421330ab9902.tar.gz
MDEV-9823 LOAD DATA INFILE silently truncates incomplete byte sequences
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-eucjpms.c1
-rw-r--r--strings/ctype-mb.ic6
-rw-r--r--strings/ctype-ujis.c1
3 files changed, 8 insertions, 0 deletions
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 52494b7dfb3..469d3a5be6c 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -199,6 +199,7 @@ static const uchar sort_order_eucjpms[]=
#define IS_MB2_KATA(x,y) (iseucjpms_ss2(x) && iskata(y))
#define IS_MB2_CHAR(x,y) (IS_MB2_KATA(x,y) || IS_MB2_JIS(x,y))
#define IS_MB3_CHAR(x,y,z) (iseucjpms_ss3(x) && IS_MB2_JIS(y,z))
+#define IS_MB_PREFIX2(x,y) (iseucjpms_ss3(x) && iseucjpms(y))
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"
diff --git a/strings/ctype-mb.ic b/strings/ctype-mb.ic
index 6fc4d6e3db4..2df9c9d5e49 100644
--- a/strings/ctype-mb.ic
+++ b/strings/ctype-mb.ic
@@ -75,7 +75,13 @@ MY_FUNCTION_NAME(charlen)(CHARSET_INFO *cs __attribute__((unused)),
#ifdef IS_MB3_CHAR
if (b + 3 > e)
+ {
+#ifdef IS_MB_PREFIX2
+ if (!IS_MB_PREFIX2(b[0], b[1]))
+ return MY_CS_ILSEQ;
+#endif
return MY_CS_TOOSMALLN(3);
+ }
if (IS_MB3_CHAR(b[0], b[1], b[2]))
return 3; /* Three-byte character */
#endif
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index 67e68901573..b24fdb3075f 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -198,6 +198,7 @@ static const uchar sort_order_ujis[]=
#define IS_MB2_KATA(x,y) (isujis_ss2(x) && iskata(y))
#define IS_MB2_CHAR(x, y) (IS_MB2_KATA(x,y) || IS_MB2_JIS(x,y))
#define IS_MB3_CHAR(x, y, z) (isujis_ss3(x) && IS_MB2_JIS(y,z))
+#define IS_MB_PREFIX2(x,y) (isujis_ss3(x) && isujis(y))
#define DEFINE_ASIAN_ROUTINES
#include "ctype-mb.ic"