[libxslt] Fix possible NULL pointer deref in transform.c



commit 07c31851334c8872a23c7554cc182e92783e43fd
Author: mahendra.n <mahendra n samsung com>
Date:   Sun Dec 13 19:33:03 2015 +0100

    Fix possible NULL pointer deref in transform.c
    
    Second part of fix for bug #757665.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757665

 libxslt/transform.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 1c98254..86b0a82 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -1320,6 +1320,11 @@ xsltShallowCopyElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
     if (copy != NULL) {
        copy->doc = ctxt->output;
        copy = xsltAddChild(insert, copy);
+        if (copy == NULL) {
+             xsltTransformError(ctxt, NULL, node,
+                "xsltShallowCopyElem: copy failed\n");
+             return (copy);
+        }
 
        if (node->type == XML_ELEMENT_NODE) {
            /*
@@ -1653,6 +1658,11 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt,
     if (copy != NULL) {
        copy->doc = ctxt->output;
        copy = xsltAddChild(insert, copy);
+        if (copy == NULL) {
+            xsltTransformError(ctxt, NULL, invocNode,
+            "xsltCopyTreeInternal: Copying of '%s' failed.\n", node->name);
+            return (copy);
+        }
        /*
         * The node may have been coalesced into another text node.
         */
@@ -4132,6 +4142,11 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node,
        return;
     }
     copy = xsltAddChild(ctxt->insert, copy);
+    if (copy == NULL) {
+        xsltTransformError(ctxt, NULL, inst,
+            "xsl:element : xsltAddChild failed\n");
+        return;
+    }
 
     /*
     * Namespace


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