pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Calling xlst_process with certain arguments causes server crash
5+ messages / 2 participants
[nested] [flat]

* Calling xlst_process with certain arguments causes server crash
@ 2012-06-04 12:57 pgagarinov@alliedtesting.com
  0 siblings, 0 replies; 5+ messages in thread

From: pgagarinov@alliedtesting.com @ 2012-06-04 12:57 UTC (permalink / raw)
  To: pgsql-bugs

Hello,

It looks like calling xlst_process as follows causes a crash:

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/*">
    <elem type="{@type}" name="{name()}">
      <xsl:value-of select="."/>
      <xsl:attribute name="href">
          result.asp?value=<xsl:value-of select="."/>
      </xsl:attribute>
    </elem>
  </xsl:template>
</xsl:stylesheet>','')

After the crash pglog contains the following records:





Peter Gagarinov | Head of Modelling and Analytics

Allied Testing

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Calling xlst_process with certain arguments causes server crash
@ 2012-06-04 13:00 pgagarinov@alliedtesting.com
  2012-06-04 20:33 ` Re: Calling xlst_process with certain arguments causes server crash Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: pgagarinov@alliedtesting.com @ 2012-06-04 13:00 UTC (permalink / raw)
  To: pgsql-bugs

Hello,

It looks like calling xlst_process as follows causes a crash:

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/*">
    <elem type="{@type}" name="{name()}">
      <xsl:value-of select="."/>
      <xsl:attribute name="href">
          result.asp?value=<xsl:value-of select="."/>
      </xsl:attribute>
    </elem>
  </xsl:template>

</xsl:stylesheet>','')

After the crash pglog contains the following records:

2012-06-04 16:32:40.927 MSDLOG:  server process (PID 4512) was terminated by exception 0xC0000005
2012-06-04 16:32:40.927 MSDHINT:  See C include file "ntstatus.h" for a description of the hexadecimal value.
2012-06-04 16:32:40.927 MSDLOG:  terminating any other active server processes

Could you please help to figure out how it can be fixed?

Thanks,
Peter


Peter Gagarinov | Head of Modelling and Analytics

Allied Testing

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Calling xlst_process with certain arguments causes server crash
  2012-06-04 13:00 Re: Calling xlst_process with certain arguments causes server crash pgagarinov@alliedtesting.com
@ 2012-06-04 20:33 ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-06-05 00:16   ` Re: Calling xlst_process with certain arguments causes server crash Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2012-06-04 20:33 UTC (permalink / raw)
  To: pgagarinov@alliedtesting.com; +Cc: pgsql-bugs

<pgagarinov@alliedtesting.com> writes:
> It looks like calling xlst_process as follows causes a crash:

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"?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Calling xlst_process with certain arguments causes server crash
  2012-06-04 13:00 Re: Calling xlst_process with certain arguments causes server crash pgagarinov@alliedtesting.com
  2012-06-04 20:33 ` Re: Calling xlst_process with certain arguments causes server crash Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-06-05 00:16   ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-06-05 12:07     ` Re: Calling xlst_process with certain arguments causes server crash pgagarinov@alliedtesting.com
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2012-06-05 00:16 UTC (permalink / raw)
  To: pgagarinov@alliedtesting.com; +Cc: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Calling xlst_process with certain arguments causes server crash
  2012-06-04 13:00 Re: Calling xlst_process with certain arguments causes server crash pgagarinov@alliedtesting.com
  2012-06-04 20:33 ` Re: Calling xlst_process with certain arguments causes server crash Tom Lane <tgl@sss.pgh.pa.us>
  2012-06-05 00:16   ` Re: Calling xlst_process with certain arguments causes server crash Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-06-05 12:07     ` pgagarinov@alliedtesting.com
  0 siblings, 0 replies; 5+ messages in thread

From: pgagarinov@alliedtesting.com @ 2012-06-05 12:07 UTC (permalink / raw)
  To: tgl@sss.pgh.pa.us; +Cc: 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="{@type}" name="{global-name()}">
		<xsl:value-of select="./item"/>
		</elem>
		<xsl:text>&#10;</xsl:text>		
        </xsl:if>
        <xsl:if test="not(item)">
		<elem type="{@type}" name="{name()}">
		<xsl:value-of select="."/>
		</elem>
		<xsl:text>&#10;</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@sss.pgh.pa.us] 
Sent: Tuesday, June 05, 2012 4:16 AM
To: Peter Gagarinov
Cc: pgsql-bugs@postgresql.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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2012-06-05 12:07 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-06-04 12:57 Calling xlst_process with certain arguments causes server crash pgagarinov@alliedtesting.com
2012-06-04 13:00 Re: Calling xlst_process with certain arguments causes server crash pgagarinov@alliedtesting.com
2012-06-04 20:33 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-06-05 00:16   ` Tom Lane <tgl@sss.pgh.pa.us>
2012-06-05 12:07     ` pgagarinov@alliedtesting.com

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox