[libxml2] Fix an old bug in xmlSchemaValidateOneElement



commit 1f6c42cffd8db69fd0243b2baa74104d66a3b05e
Author: Csaba László <Laszlo Csaba noreg hu>
Date:   Mon Mar 18 15:30:00 2013 +0800

    Fix an old bug in xmlSchemaValidateOneElement
    
    Recently I have run into the very same problem Tiberius Duluman did back in
    Wed, 13 May 2009 15:56:55 +0300 ([xml] Bug in xmlSchemaValidateOneElement
    function). Now I can proof now that his problem is a valid problem. I checked
    the latest available version of xmlschemas.c (2.9.0.) and the problem is still
    there!
    I think I have found a solution to the problem which I'd like proof with you:
    My quick solution to the problem is to replace line 27849 in
    xmlschemas.c
    (v2.9.0.) in function xmlSchemaVDocWalk
        valRoot = xmlDocGetRootElement(vctxt->doc);
    with this one:
        valRoot = vctxt->validationRoot ? vctxt->validationRoot : xmlDocGetRootElement(vctxt->doc);
    Currently I'm using version 2.7.8. in Windows and this change seems to solve
    the problem.

 xmlschemas.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/xmlschemas.c b/xmlschemas.c
index a08813d..121533f 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -27863,7 +27863,10 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
     const xmlChar *nsName;
 
     /* DOC VAL TODO: Move this to the start function. */
-    valRoot = xmlDocGetRootElement(vctxt->doc);
+    if (vctxt->validationRoot != NULL)
+        valRoot = vctxt->validationRoot;
+    else
+       valRoot = xmlDocGetRootElement(vctxt->doc);
     if (valRoot == NULL) {
        /* VAL TODO: Error code? */
        VERROR(1, NULL, "The document has no document element");


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