[PATCH v2] msxml3: use XSD regex quantifier format S{0, m} instead of S{, m}

Damjan Jovanovic damjan.jov at gmail.com
Wed Aug 11 00:16:53 CDT 2021


S{,m} is invalid in libxml2 2.9.11 and later, and was never valid
in the XSD specification or any XML implementation tested. We
should only use S{0,m} for our internal XSD schema used in XDR validation.

Try 2 adds a test.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51358
Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 dlls/msxml3/datatypes.xsd  | 4 ++--
 dlls/msxml3/tests/schema.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)
-------------- next part --------------
diff --git a/dlls/msxml3/datatypes.xsd b/dlls/msxml3/datatypes.xsd
index 9e0479d8ca2..ffbe0e2f858 100644
--- a/dlls/msxml3/datatypes.xsd
+++ b/dlls/msxml3/datatypes.xsd
@@ -200,7 +200,7 @@
         </xsd:annotation>
 
         <xsd:restriction base="xsd:decimal">
-            <xsd:pattern value="([0-9]{,14})([.][0-9]{,4})?"/>
+            <xsd:pattern value="([0-9]{0,14})([.][0-9]{0,4})?"/>
         </xsd:restriction>
     </xsd:simpleType>
 
@@ -539,7 +539,7 @@
         </xsd:annotation>
 
         <xsd:restriction base="xsd:string">
-            <xsd:pattern value="([0-9A-Fa-f]{4})([-]{,1}[0-9A-Fa-f]{4})*"/>
+            <xsd:pattern value="([0-9A-Fa-f]{4})([-]{0,1}[0-9A-Fa-f]{4})*"/>
         </xsd:restriction>
     </xsd:simpleType>
 
diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c
index b66be76c159..8dc9dcd7e22 100644
--- a/dlls/msxml3/tests/schema.c
+++ b/dlls/msxml3/tests/schema.c
@@ -1115,7 +1115,9 @@ static void test_regex(void)
         { L"\\~", L"~", TRUE },
         { L"\\uCAFE", L"\xCAFE", TRUE },
         /* non-BMP character in surrogate pairs: */
-        { L"\\uD83D\\uDE00", L"\xD83D\xDE00", TRUE }
+        { L"\\uD83D\\uDE00", L"\xD83D\xDE00", TRUE },
+        /* "x{,2}" is non-standard and only works on libxml2 <= v2.9.10 */
+        { L"x{0,2}", L"x", FALSE }
     };
 
     int i;


More information about the wine-devel mailing list