From: | <pgagarinov(at)alliedtesting(dot)com> |
---|---|
To: | <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Calling xlst_process with certain arguments causes server crash |
Date: | 2012-06-05 12:07:37 |
Message-ID: | DDAE57CA020DB347B405A6E6829F4B791123F27A@MAIL2A.alliedtesting.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hello Tom,
Here is another example that causes a crash, probably for the same reason but better be safe than sorry:
select xslt_process('<root xml_tb_version="2.0" type="struct" >
<ttm type="int32" >60</ttm>
<delta type="double" >0.75</delta>
<ttm2 type="int32" >30</ttm2>
<delta2 type="double" >0.75</delta2>
<expMonthNum type="int32" >1</expMonthNum>
<assetComb type="cell" >
<item type="char" >calendar spread</item>
</assetComb>
</root>',
'<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="root">
<xsl:for-each select="*">
<xsl:if test="item">
<elem type="{(at)type}" name="{global-name()}">
<xsl:value-of select="./item"/>
</elem>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="not(item)">
<elem type="{(at)type}" name="{name()}">
<xsl:value-of select="."/>
</elem>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>','')
A correct error report for this case would be something like "function global-name is unknown" (I've just replaced a correct "name" function with "global-name") but of course "failed to apply stylesheet" is still better than a crash :)
Thanks,
Peter
Peter Gagarinov | Head of Modelling and Analytics
Allied Testing
-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Tuesday, June 05, 2012 4:16 AM
To: Peter Gagarinov
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] Calling xlst_process with certain arguments causes server crash
I wrote:
> Hm, apparently xsltApplyStylesheet returns a NULL in this example, and
> we're passing that on to xsltSaveResultToString which is not expecting
> any such thing. I presume we need another error check here, but what
> should the error say exactly? Can we get any info more detailed than
> "failed to apply stylesheet"?
Apparently not -- or at least, if libxslt provides any easy way to extract error reports, it's not evident from the pretty-awful documentation. I've committed a fix that just reports "failed to apply stylesheet".
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | luigi pinna | 2012-06-05 15:21:35 | version of postgreSQL |
Previous Message | jo | 2012-06-05 07:16:22 | Re: BUG #6669: unique index w/ multiple columns and NULLs |