[xml/sgml-pkgs] Bug#860076: XSD schema does not report invalid regex match
Mathieu Malaterre
malat at debian.org
Tue Apr 11 07:36:29 UTC 2017
Package: libxml2-utils
Version: 2.9.4+dfsg1-2.2
It looks like there is an issue in parsing (interpreting?) the following regex:
<xs:simpleType name="UniqueIdentifier">
<xs:restriction base="xs:string">
<xs:minLength value="3"/>
<xs:maxLength value="64"/>
<xs:pattern value="(([1-9][0-9]*)|0)(\.([1-9][0-9]*|0))+"/>
</xs:restriction>
</xs:simpleType>
Steps:
$ xmllint --noout --schema bug.xsd bug.xml
bug.xml validates
Clearly xmllint should have failed the validation. I did test the
regex online and in python interpreter it should not have worked.
Python 2.7.12+ (default, Aug 4 2016, 20:04:34)
[GCC 6.1.1 20160724] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> p=re.compile("(([1-9][0-9]*)|0)(\.([1-9][0-9]*|0))+")
>>> p.match("123") == None
True
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.xml
Type: text/xml
Size: 77 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-xml-sgml-pkgs/attachments/20170411/6234e912/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.xsd
Type: application/octet-stream
Size: 713 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-xml-sgml-pkgs/attachments/20170411/6234e912/attachment.obj>
More information about the debian-xml-sgml-pkgs
mailing list