After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 336394 - Found a write to NULL in transform.c in a low memory condition
Found a write to NULL in transform.c in a low memory condition
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-03-28 20:03 UTC by Charles Hardin
Modified: 2006-03-29 10:17 UTC
See Also:
GNOME target: ---
GNOME version: 2.1/2.2



Description Charles Hardin 2006-03-28 20:03:45 UTC
Please describe the problem:
Was running xsltproc to test some transforms being done on another product and got a SEGFAULT... 
Tracked it back to failed allocated from xmlNewTextLen in xsltCopyTextString...

Steps to reproduce:
1. modify libxml2 to randomly return NULL on xmlMalloc to mimic low memory conditions...
2. start tracking down the SEGFAULTS


Actual results:


Expected results:


Does this happen every time?


Other information:
Index: transform.c
===============================================================
====
RCS file: /cvs/gnome/libxslt/libxslt/transform.c,v
retrieving revision 1.284
diff -u -p -r1.284 transform.c
--- transform.c 10 Mar 2006 11:51:20 -0000      1.284
+++ transform.c 28 Mar 2006 19:54:49 -0000
@@ -638,7 +638,8 @@ xsltCopyTextString(xsltTransformContextP
            return(xsltAddTextString(ctxt, target->last, string, len));
        }
        copy = xmlNewTextLen(string, len);
-       copy->name = xmlStringTextNoenc;
+       if (copy)
+           copy->name = xmlStringTextNoenc;
     } else {
        if ((target != NULL) && (target->last != NULL) &&
            (target->last->type == XML_TEXT_NODE) &&
Comment 1 Daniel Veillard 2006-03-29 10:17:46 UTC
Right, good find, the other allocations are checked but it seems I missed
that one :-)
Applied and commited in CVS,

  thanks !

Daniel