Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
39385ff7
Commit
39385ff7
authored
Jun 27, 2017
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-13187 incorrect backslash parsing in clients
don't do backslash escapes inside backticks
parent
ded614d7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
4 deletions
+47
-4
client/mysql.cc
client/mysql.cc
+2
-2
client/mysqltest.cc
client/mysqltest.cc
+2
-2
mysql-test/r/mysql.result
mysql-test/r/mysql.result
+28
-0
mysql-test/t/mysql.test
mysql-test/t/mysql.test
+15
-0
No files found.
client/mysql.cc
View file @
39385ff7
...
@@ -2287,8 +2287,8 @@ static bool add_line(String &buffer, char *line, ulong line_length,
...
@@ -2287,8 +2287,8 @@ static bool add_line(String &buffer, char *line, ulong line_length,
continue
;
continue
;
}
}
#endif
#endif
if
(
!*
ml_comment
&&
inchar
==
'\\'
&&
if
(
!*
ml_comment
&&
inchar
==
'\\'
&&
*
in_string
!=
'`'
&&
!
(
*
in_string
&&
!
(
*
in_string
&&
(
mysql
.
server_status
&
SERVER_STATUS_NO_BACKSLASH_ESCAPES
)))
(
mysql
.
server_status
&
SERVER_STATUS_NO_BACKSLASH_ESCAPES
)))
{
{
// Found possbile one character command like \c
// Found possbile one character command like \c
...
...
client/mysqltest.cc
View file @
39385ff7
...
@@ -6594,7 +6594,7 @@ int read_line(char *buf, int size)
...
@@ -6594,7 +6594,7 @@ int read_line(char *buf, int size)
state
=
R_Q
;
state
=
R_Q
;
}
}
}
}
have_slash
=
(
c
==
'\\'
);
have_slash
=
(
c
==
'\\'
&&
last_quote
!=
'`'
);
break
;
break
;
case
R_COMMENT
:
case
R_COMMENT
:
...
@@ -6664,7 +6664,7 @@ int read_line(char *buf, int size)
...
@@ -6664,7 +6664,7 @@ int read_line(char *buf, int size)
case
R_Q
:
case
R_Q
:
if
(
c
==
last_quote
)
if
(
c
==
last_quote
)
state
=
R_NORMAL
;
state
=
R_NORMAL
;
else
if
(
c
==
'\\'
)
else
if
(
c
==
'\\'
&&
last_quote
!=
'`'
)
state
=
R_SLASH_IN_Q
;
state
=
R_SLASH_IN_Q
;
break
;
break
;
...
...
mysql-test/r/mysql.result
View file @
39385ff7
...
@@ -529,3 +529,31 @@ a
...
@@ -529,3 +529,31 @@ a
+-------------------+
+-------------------+
End of tests
End of tests
create table `a1\``b1` (a int);
show tables;
Tables_in_test
a1\`b1
insert `a1\``b1` values (1),(2);
show create table `a1\``b1`;
Table Create Table
a1\`b1 CREATE TABLE `a1\``b1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `a1\``b1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `a1\``b1` VALUES (1),(2);
insert `a1\``b1` values (4),(5);
show create table `a1\``b1`;
Table Create Table
a1\`b1 CREATE TABLE `a1\``b1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from `a1\``b1`;
a
1
2
drop table `a1\``b1`;
mysql-test/t/mysql.test
View file @
39385ff7
...
@@ -618,3 +618,18 @@ EOF
...
@@ -618,3 +618,18 @@ EOF
--
echo
--
echo
--
echo
End
of
tests
--
echo
End
of
tests
#
# MDEV-13187 incorrect backslash parsing in clients
#
create
table
`a1\``
b1
` (a int);
show tables;
insert `
a1
\
``
b1
` values (1),(2);
show create table `
a1
\
``
b1
`;
--exec $MYSQL_DUMP --compact test
--exec $MYSQL_DUMP test > $MYSQLTEST_VARDIR/tmp/bug.sql
insert `
a1
\
``
b1
` values (4),(5);
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug.sql
show create table `
a1
\
``
b1
`;
select * from `
a1
\
``
b1
`;
drop table `
a1
\
``
b1
`
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment