Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
N/A
-
None
Description
XMLSchema_any_type::validate_attr() accepts the attribute but pushes nothing on the validation stack, so the end of the attribute pops the element itself (XMLSchema_element_global::validate_leave()). The rest of the element, its closing tag included, is then validated one level up: children are matched against the parent's content model or the global elements, and the parent's end check runs at the element's closing tag. Elements without a type are xs:anyType since MDEV-41821, so they are affected as well.
SET @s= '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="r"/></xs:schema>'; |
--echo # BUG if with_attr = 0, r has no type (xs:anyType)
|
SELECT XMLISVALID('<r><x/></r>', @s) AS no_attr, XMLISVALID('<r a="1"><x/></r>', @s) AS with_attr; |
|
|
SET @s= '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
<xs:element name="R"><xs:complexType><xs:sequence>
|
<xs:element name="E" type="xs:anyType"/>
|
<xs:element name="F" type="xs:int" minOccurs="0"/>
|
</xs:sequence></xs:complexType></xs:element>
|
<xs:element name="F" type="xs:string"/>
|
</xs:schema>'; |
--echo # BUG if with_attr = 1, local F is xs:int
|
SELECT XMLISVALID('<R><E></E><F>abc</F></R>', @s) AS no_attr, XMLISVALID('<R><E a="1"></E><F>abc</F></R>', @s) AS with_attr; |
13.2.0-MariaDB-asan-debug-log source revision: bd45fd917d4ef23ca1c4f62ca63473c08c03c8de
|
|
|
SET @s= '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="r"/></xs:schema>';
|
# BUG if with_attr = 0, r has no type (xs:anyType)
|
SELECT XMLISVALID('<r><x/></r>', @s) AS no_attr, XMLISVALID('<r a="1"><x/></r>', @s) AS with_attr;
|
no_attr with_attr
|
1 0
|
SET @s= '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
<xs:element name="R"><xs:complexType><xs:sequence>
|
<xs:element name="E" type="xs:anyType"/>
|
<xs:element name="F" type="xs:int" minOccurs="0"/>
|
</xs:sequence></xs:complexType></xs:element>
|
<xs:element name="F" type="xs:string"/>
|
</xs:schema>';
|
# BUG if with_attr = 1, local F is xs:int
|
SELECT XMLISVALID('<R><E></E><F>abc</F></R>', @s) AS no_attr, XMLISVALID('<R><E a="1"></E><F>abc</F></R>', @s) AS with_attr;
|
no_attr with_attr
|
0 1
|
Attachments
Issue Links
- is caused by
-
MDEV-37262 XMLISVALID() schema validation function
-
- Stalled
-
- relates to
-
MDEV-41821 XMLISVALID returns unexepected result, various corner cases
-
- Closed
-