summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-08-07 23:32:01 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-08-07 23:32:01 -0300
commitc7163c630a7ab5c9770c9ae07355acc531f110a1 (patch)
treeffaa8e6fff678b5b86aabefb449700837770e903 /mysql-test
parenta791f20089a6e5a0f89f93aa427b43c7ec920079 (diff)
downloadmariadb-git-c7163c630a7ab5c9770c9ae07355acc531f110a1.tar.gz
Bug#45010: invalid memory reads during parsing some strange statements
The problem is that the lexer could inadvertently skip over the end of a query being parsed if it encountered a malformed multibyte character. A specially crated query string could cause the lexer to jump up to six bytes past the end of the query buffer. Another problem was that the laxer could use unfiltered user input as a signed array index for the parser maps (having upper and lower bounds 0 and 256 respectively). The solution is to ensure that the lexer only skips over well-formed multibyte characters and that the index value of the parser maps is always a unsigned value. mysql-test/r/ctype_recoding.result: Update test case result: ending backtick is not skipped over anymore. sql/sql_lex.cc: Characters being analyzed must be unsigned as they can be used as indexes for the parser maps. Only skip over if the string is a valid multi-byte sequence. tests/mysql_client_test.c: Add test case for Bug#45010
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ctype_recoding.result2
1 files changed, 1 insertions, 1 deletions
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 3f8ab75957b..4d7d33933cf 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -165,7 +165,7 @@ 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)'
+ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
set names latin1;
create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test');