[libxml2] Fix regression in RelaxNG pattern matching
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix regression in RelaxNG pattern matching
- Date: Sun, 13 Feb 2022 22:45:02 +0000 (UTC)
commit daf2d9c3deda5f8750d7f7b1402a505751da0133
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Tue Feb 8 04:30:29 2022 +0100
Fix regression in RelaxNG pattern matching
XML_SCHEMAS_QNAME is not a string-derived type. Other types up to
XML_SCHEMAS_ENTITIES are.
Should fix #224.
xmlschemastypes.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 9c2dff06..af31be5f 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -5431,7 +5431,6 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType ws)
{
int ret;
- int stringType;
if (facet == NULL)
return(-1);
@@ -5449,10 +5448,16 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
* the datatype.
* See https://www.w3.org/TR/xmlschema-2/#rf-pattern
*/
- stringType = val && ((val->type >= XML_SCHEMAS_STRING && val->type <= XML_SCHEMAS_NORMSTRING)
- || (val->type >= XML_SCHEMAS_TOKEN && val->type <= XML_SCHEMAS_NCNAME));
- ret = xmlRegexpExec(facet->regexp,
- (stringType && val->value.str) ? val->value.str : value);
+ if (val &&
+ val->value.str &&
+ ((val->type >= XML_SCHEMAS_STRING &&
+ val->type <= XML_SCHEMAS_NORMSTRING) ||
+ (val->type >= XML_SCHEMAS_TOKEN &&
+ val->type <= XML_SCHEMAS_ENTITIES &&
+ val->type != XML_SCHEMAS_QNAME))) {
+ value = val->value.str;
+ }
+ ret = xmlRegexpExec(facet->regexp, value);
if (ret == 1)
return(0);
if (ret == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]