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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
64d33032
Commit
64d33032
authored
Apr 23, 2014
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge 5.3->5.5
parents
2f93e7cf
a24ea50d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
6 deletions
+37
-6
mysql-test/r/xml.result
mysql-test/r/xml.result
+19
-1
mysql-test/t/xml.test
mysql-test/t/xml.test
+13
-1
strings/xml.c
strings/xml.c
+5
-4
No files found.
mysql-test/r/xml.result
View file @
64d33032
...
...
@@ -132,7 +132,7 @@ xb1 xc1
SELECT extractValue(@xml,'/a//@x[2]');
extractValue(@xml,'/a//@x[2]')
xb2 xc2
SET @xml='
<a><b>
b1
</b><b>
b2
</b><c><b>
c1b1
</b><b>
c1b2
</b></c><c><b>
c2b1
</
c></b
></a>
';
SET @xml='
<a><b>
b1
</b><b>
b2
</b><c><b>
c1b1
</b><b>
c1b2
</b></c><c><b>
c2b1
</
b></c
></a>
';
SELECT extractValue(@xml,'//b[1]');
extractValue(@xml,'//b[1]')
b1 c1b1 c2b1
...
...
@@ -1134,6 +1134,24 @@ Warnings:
Warning
1525
Incorrect
XML
value:
'
parse
error
at
line
1
pos
11:
STRING
unexpected
(
ident
or
'/'
wanted
)'
End
of
5
.
1
tests
#
#
Start
of
5
.
3
tests
#
#
#
MDEV-5338
XML
parser
accepts
malformed
data
#
SELECT
ExtractValue
('<
a
>
xxx
</c>
','/a/b');
ExtractValue('
<a>
xxx
</c>
','/a/b')
NULL
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 10: '
</c>
' unexpected ('
</a>
' wanted)'
SELECT ExtractValue('
<a><b>
xxx
</c></a>
','/a/b');
ExtractValue('
<a><b>
xxx
</c></a>
','/a/b')
NULL
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 13: '
</c>
' unexpected ('
</b>
' wanted)'
#
# End of 5.3 tests
#
# Start of 5.5 tests
#
#
...
...
mysql-test/t/xml.test
View file @
64d33032
...
...
@@ -53,7 +53,7 @@ SELECT extractValue(@xml,'/a//@x');
SELECT
extractValue
(
@
xml
,
'/a//@x[1]'
);
SELECT
extractValue
(
@
xml
,
'/a//@x[2]'
);
SET
@
xml
=
'<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</
c></b
></a>'
;
SET
@
xml
=
'<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</
b></c
></a>'
;
SELECT
extractValue
(
@
xml
,
'//b[1]'
);
SELECT
extractValue
(
@
xml
,
'/descendant::b[1]'
);
...
...
@@ -653,6 +653,18 @@ SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1);
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# Start of 5.3 tests
--
echo
#
--
echo
#
--
echo
# MDEV-5338 XML parser accepts malformed data
--
echo
#
SELECT
ExtractValue
(
'<a>xxx</c>'
,
'/a/b'
);
SELECT
ExtractValue
(
'<a><b>xxx</c></a>'
,
'/a/b'
);
--
echo
#
--
echo
# End of 5.3 tests
--
echo
#
--
echo
# Start of 5.5 tests
...
...
strings/xml.c
View file @
64d33032
...
...
@@ -239,7 +239,7 @@ static void mstr(char *s,const char *src,size_t l1, size_t l2)
static
int
my_xml_leave
(
MY_XML_PARSER
*
p
,
const
char
*
str
,
size_t
slen
)
{
char
*
e
;
char
*
e
,
*
tag
;
size_t
glen
;
char
s
[
32
];
char
g
[
32
];
...
...
@@ -248,13 +248,14 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, size_t slen)
/* Find previous '/' or beginning */
for
(
e
=
p
->
attrend
;
(
e
>
p
->
attr
)
&&
(
e
[
0
]
!=
'/'
)
;
e
--
);
glen
=
(
size_t
)
((
e
[
0
]
==
'/'
)
?
(
p
->
attrend
-
e
-
1
)
:
p
->
attrend
-
e
);
if
(
str
&&
(
slen
!=
glen
))
tag
=
e
[
0
]
==
'/'
?
e
+
1
:
e
;
if
(
str
&&
(
slen
!=
glen
||
memcmp
(
str
,
tag
,
slen
)))
{
mstr
(
s
,
str
,
sizeof
(
s
)
-
1
,
slen
);
if
(
glen
)
{
mstr
(
g
,
e
+
1
,
sizeof
(
g
)
-
1
,
glen
),
mstr
(
g
,
tag
,
sizeof
(
g
)
-
1
,
glen
);
sprintf
(
p
->
errstr
,
"'</%s>' unexpected ('</%s>' wanted)"
,
s
,
g
);
}
else
...
...
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