Nikolay Sivov : msxml3: Protect SAX character callback from null node.

Alexandre Julliard julliard at winehq.org
Mon Mar 14 14:29:34 CDT 2011


Module: wine
Branch: master
Commit: 610725289b18f07c3ec62438773ff52a01426565
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=610725289b18f07c3ec62438773ff52a01426565

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Mar 13 13:46:45 2011 +0300

msxml3: Protect SAX character callback from null node.

---

 dlls/msxml3/domdoc.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 81ffb49..1277ce1 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -421,19 +421,22 @@ static inline BOOL strn_isspace(xmlChar const* str, int len)
 
 static void sax_characters(void *ctx, const xmlChar *ch, int len)
 {
-    xmlParserCtxtPtr pctx;
-    domdoc const* This;
+    xmlParserCtxtPtr ctxt;
+    const domdoc *This;
 
-    pctx = (xmlParserCtxtPtr) ctx;
-    This = (domdoc const*) pctx->_private;
+    ctxt = (xmlParserCtxtPtr) ctx;
+    This = (const domdoc*) ctxt->_private;
 
-    /* during domdoc_loadXML() the xmlDocPtr->_private data is not available */
-    if (!This->properties->preserving &&
-        !is_preserving_whitespace(pctx->node) &&
-        strn_isspace(ch, len))
-        return;
+    if (ctxt->node)
+    {
+        /* during domdoc_loadXML() the xmlDocPtr->_private data is not available */
+        if (!This->properties->preserving &&
+            !is_preserving_whitespace(ctxt->node) &&
+            strn_isspace(ch, len))
+            return;
+    }
 
-    xmlSAX2Characters(ctx, ch, len);
+    xmlSAX2Characters(ctxt, ch, len);
 }
 
 static void LIBXML2_LOG_CALLBACK sax_error(void* ctx, char const* msg, ...)




More information about the wine-cvs mailing list