Re: [xml] [PATCH] xmllint: Fix validation of URIs with ampersands



Hum, I would say it's the wrong way. IT doesn't affect the library, but
we definitely don't want XML_PARSER_SUBST_ENTITIES by default. Using
it means you trust the document. It's better to add the flag only
when needed. Also I'm not sure it's the right 'way', I would expect
validation fixes to be done in the schemas code, not by tweaking
parser options,

Daniel
On Wed, Feb 25, 2015 at 04:20:49PM -0700, Alex Henrie wrote:
Fixes bug #709171
---
 xmllint.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xmllint.c b/xmllint.c
index b297ded..c90f608 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -1901,6 +1901,12 @@ static void streamFile(char *filename) {
          if ((timing) && (!repeat)) {
              startTimer();
          }
+         /*
+          * Attributes of type anyURI cannot be validated unless their
+          * entities are resolved. XML_PARSER_SUBST_ENTITIES makes sure that
+          * this happens in stream mode.
+          */
+         xmlTextReaderSetParserProp(reader, XML_PARSER_SUBST_ENTITIES, 1);
          ret = xmlTextReaderSchemaValidate(reader, schema);
          if (ret < 0) {
              xmlGenericError(xmlGenericErrorContext,
-- 
2.3.0

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
https://mail.gnome.org/mailman/listinfo/xml

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]