Skip site navigation (1) Skip section navigation (2)

Re: BUG #3860: xpath crashes backend when is queryingxmlagg result

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sokolov Yura <funny(dot)falcon(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: BUG #3860: xpath crashes backend when is queryingxmlagg result
Date: 2008-01-11 03:41:40
Message-ID: 20080111034140.GV6465@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
Tom Lane escribió:

> One thing I was wondering about earlier today is whether libxml isn't
> expecting NULL-return-on-failure from the malloc-substitute routine.
> If we take control away from it unexpectedly, I wouldn't be a bit
> surprised if its data structures are left corrupt.  This might lead to
> failures during cleanup.

Hmm, this is a very good point.  I quick look at the source shows that
they are not very consistent on its own checking for memory allocation
errors.  For example, see a bug I just reported:

http://bugzilla.gnome.org/show_bug.cgi?id=508662

The problem is that many routines look like this:

xmlXPathNewNodeSet(xmlNodePtr val) {
    xmlXPathObjectPtr ret;

    ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
    if (ret == NULL) {
        xmlXPathErrMemory(NULL, "creating nodeset\n");
        return(NULL);
    }


and others would call this code and then happily use the return value
without checking for null.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2008-01-11 03:48:17
Subject: Re: BUG #3860: xpath crashes backend when is querying xmlagg result
Previous:From: Tom LaneDate: 2008-01-11 00:23:06
Subject: Re: BUG #3860: xpath crashes backend when is querying xmlagg result

pgsql-patches by date

Next:From: Tom LaneDate: 2008-01-11 03:48:17
Subject: Re: BUG #3860: xpath crashes backend when is querying xmlagg result
Previous:From: Tom LaneDate: 2008-01-11 00:23:06
Subject: Re: BUG #3860: xpath crashes backend when is querying xmlagg result

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group