summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-09-06 22:31:30 +0200
committerSergei Golubchik <sergii@pisem.net>2013-09-06 22:31:30 +0200
commitb838d081ad346e52787753b1799c627922c4a6c7 (patch)
treedc8f1e21e6b40d5b72668571c570c9a3214fbf32 /strings
parent824db55ce53963a64fcf648b54500df22c57e9b2 (diff)
parent72c36f4415815d55ddb82b23682f3c549906c00e (diff)
downloadmariadb-git-b838d081ad346e52787753b1799c627922c4a6c7.tar.gz
mysql-5.5.33 merge
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-uca.c40
-rw-r--r--strings/ctype-utf8.c8
2 files changed, 26 insertions, 22 deletions
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 020cfdfcbbe..0f464be607d 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -8981,10 +8981,12 @@ static uchar ctype_utf8[] = {
extern MY_CHARSET_HANDLER my_charset_utf8_handler;
+#define MY_CS_UTF8MB3_UCA_FLAGS (MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE)
+
struct charset_info_st my_charset_utf8_unicode_ci=
{
192,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_unicode_ci", /* name */
"", /* comment */
@@ -9049,7 +9051,7 @@ struct charset_info_st my_charset_utf8_icelandic_uca_ci=
struct charset_info_st my_charset_utf8_latvian_uca_ci=
{
194,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_latvian_ci", /* name */
"", /* comment */
@@ -9081,7 +9083,7 @@ struct charset_info_st my_charset_utf8_latvian_uca_ci=
struct charset_info_st my_charset_utf8_romanian_uca_ci=
{
195,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_romanian_ci", /* name */
"", /* comment */
@@ -9113,7 +9115,7 @@ struct charset_info_st my_charset_utf8_romanian_uca_ci=
struct charset_info_st my_charset_utf8_slovenian_uca_ci=
{
196,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_slovenian_ci",/* name */
"", /* comment */
@@ -9145,7 +9147,7 @@ struct charset_info_st my_charset_utf8_slovenian_uca_ci=
struct charset_info_st my_charset_utf8_polish_uca_ci=
{
197,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_polish_ci", /* name */
"", /* comment */
@@ -9177,7 +9179,7 @@ struct charset_info_st my_charset_utf8_polish_uca_ci=
struct charset_info_st my_charset_utf8_estonian_uca_ci=
{
198,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_estonian_ci", /* name */
"", /* comment */
@@ -9209,7 +9211,7 @@ struct charset_info_st my_charset_utf8_estonian_uca_ci=
struct charset_info_st my_charset_utf8_spanish_uca_ci=
{
199,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_spanish_ci", /* name */
"", /* comment */
@@ -9241,7 +9243,7 @@ struct charset_info_st my_charset_utf8_spanish_uca_ci=
struct charset_info_st my_charset_utf8_swedish_uca_ci=
{
200,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_swedish_ci", /* name */
"", /* comment */
@@ -9273,7 +9275,7 @@ struct charset_info_st my_charset_utf8_swedish_uca_ci=
struct charset_info_st my_charset_utf8_turkish_uca_ci=
{
201,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_turkish_ci", /* name */
"", /* comment */
@@ -9305,7 +9307,7 @@ struct charset_info_st my_charset_utf8_turkish_uca_ci=
struct charset_info_st my_charset_utf8_czech_uca_ci=
{
202,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_czech_ci", /* name */
"", /* comment */
@@ -9338,7 +9340,7 @@ struct charset_info_st my_charset_utf8_czech_uca_ci=
struct charset_info_st my_charset_utf8_danish_uca_ci=
{
203,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_danish_ci", /* name */
"", /* comment */
@@ -9370,7 +9372,7 @@ struct charset_info_st my_charset_utf8_danish_uca_ci=
struct charset_info_st my_charset_utf8_lithuanian_uca_ci=
{
204,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_lithuanian_ci",/* name */
"", /* comment */
@@ -9402,7 +9404,7 @@ struct charset_info_st my_charset_utf8_lithuanian_uca_ci=
struct charset_info_st my_charset_utf8_slovak_uca_ci=
{
205,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_slovak_ci", /* name */
"", /* comment */
@@ -9434,7 +9436,7 @@ struct charset_info_st my_charset_utf8_slovak_uca_ci=
struct charset_info_st my_charset_utf8_spanish2_uca_ci=
{
206,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_spanish2_ci", /* name */
"", /* comment */
@@ -9466,7 +9468,7 @@ struct charset_info_st my_charset_utf8_spanish2_uca_ci=
struct charset_info_st my_charset_utf8_roman_uca_ci=
{
207,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_roman_ci", /* name */
"", /* comment */
@@ -9498,7 +9500,7 @@ struct charset_info_st my_charset_utf8_roman_uca_ci=
struct charset_info_st my_charset_utf8_persian_uca_ci=
{
208,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_persian_ci", /* name */
"", /* comment */
@@ -9530,7 +9532,7 @@ struct charset_info_st my_charset_utf8_persian_uca_ci=
struct charset_info_st my_charset_utf8_esperanto_uca_ci=
{
209,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_esperanto_ci",/* name */
"", /* comment */
@@ -9562,7 +9564,7 @@ struct charset_info_st my_charset_utf8_esperanto_uca_ci=
struct charset_info_st my_charset_utf8_hungarian_uca_ci=
{
210,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_hungarian_ci",/* name */
"", /* comment */
@@ -9594,7 +9596,7 @@ struct charset_info_st my_charset_utf8_hungarian_uca_ci=
struct charset_info_st my_charset_utf8_sinhala_uca_ci=
{
211,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ MY_CS_UTF8MB3_UCA_FLAGS,/* flags */
"utf8", /* cs name */
"utf8_sinhala_ci", /* name */
"", /* comment */
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 92b4bc52ee9..6edaaa099f6 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2009, 2011, Monty Program Ab
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2013, Monty Program Ab
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -4392,7 +4392,9 @@ my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
return MY_CS_TOOSMALL3;
byte1= s[1];
- byte2= byte1 ? s[2] : 0;
+ if (byte1 == 0)
+ return MY_CS_ILSEQ; /* avoid possible out-of-bounds read */
+ byte2= s[2];
if (byte1 >= 0x30 && byte1 <= 0x7F &&
byte2 >= 0x30 && byte2 <= 0x7F)