Commit 5ef15478 authored by unknown's avatar unknown

Don't allow badly formed UTF8 identitiers

parent 288b8d95
......@@ -316,4 +316,5 @@
#define ER_GET_TEMPORARY_ERRMSG 1297
#define ER_UNKNOWN_TIME_ZONE 1298
#define ER_WARN_INVALID_TIMESTAMP 1299
#define ER_ERROR_MESSAGES 300
#define ER_INVALID_CHARACTER_STRING 1300
#define ER_ERROR_MESSAGES 301
......@@ -136,3 +136,9 @@ SET character_set_connection=binary;
SELECT 'тест' as s;
s
тест
SET NAMES binary;
CREATE TABLE `good` (a int);
ERROR HY000: Invalid utf8 character string: ''
SET NAMES utf8;
CREATE TABLE `good` (a int);
ERROR HY000: Invalid utf8 character string: '` (a int)'
......@@ -97,3 +97,13 @@ SELECT 'тест' as s;
SET NAMES utf8;
SET character_set_connection=binary;
SELECT 'тест' as s;
#
# Test that we allow only well-formed UTF8 identitiers
#
SET NAMES binary;
--error 1300
CREATE TABLE `good` (a int);
SET NAMES utf8;
--error 1300
CREATE TABLE `good` (a int);
......@@ -312,3 +312,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -306,3 +306,4 @@ character-set=latin1
"Modtog temporary fejl %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -314,3 +314,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -303,3 +303,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -308,3 +308,4 @@ character-set=latin7
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -303,3 +303,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -315,3 +315,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -303,3 +303,4 @@ character-set=greek
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -305,3 +305,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -303,3 +303,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -305,3 +305,4 @@ character-set=ujis
"Got temporary NDB error %d '%-.100s'",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -303,3 +303,4 @@ character-set=euckr
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -305,3 +305,4 @@ character-set=latin1
"Mottok temporary feil %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -305,3 +305,4 @@ character-set=latin1
"Mottok temporary feil %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -307,3 +307,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -304,3 +304,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -307,3 +307,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -305,3 +305,4 @@ character-set=koi8r
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -309,3 +309,4 @@ character-set=cp1250
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -311,3 +311,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -305,3 +305,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -303,3 +303,4 @@ character-set=latin1
"Fick tilfällig felkod %d '%-.100s' från %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -308,3 +308,4 @@ character-set=koi8u
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",
......@@ -4884,7 +4884,19 @@ IDENT_sys:
{
THD *thd= YYTHD;
if (thd->charset_is_system_charset)
{
CHARSET_INFO *cs= system_charset_info;
uint wlen= cs->cset->well_formed_len(cs, $1.str,
$1.str+$1.length,
$1.length);
if (wlen < $1.length)
{
net_printf(YYTHD, ER_INVALID_CHARACTER_STRING, cs->csname,
$1.str + wlen);
YYABORT;
}
$$= $1;
}
else
thd->convert_string(&$$, system_charset_info,
$1.str, $1.length, thd->charset());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment