Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#409 closed defect (fixed)

ST_AsSVG - degraded

Reported by: sdikiy Owned by: colivier
Priority: critical Milestone: PostGIS 1.4.2
Component: postgis Version: 1.4.X
Keywords: AsSVG Cc:

Description

(1)
SELECT PostGIS_Full_Version();
"POSTGIS="1.1.6" GEOS="2.2.3-CAPI-1.1.1" PROJ="Rel. 4.5.0, 22 Oct 2006" USE_STATS"

select AsText(Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry));
"GEOMETRYCOLLECTION EMPTY"

select AsSVG(Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry));
""

(2)
SELECT PostGIS_Full_Version();
"POSTGIS="1.4.0" GEOS="3.1.1-CAPI-1.6.0" PROJ="Rel. 4.6.1, 21 August 2008" USE_STATS"

select ST_AsText(ST_Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry));
"GEOMETRYCOLLECTION EMPTY"

select ST_AsSVG(ST_Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry));
ERROR: invalid memory alloc request size 4294967294
Error
ERROR: invalid memory alloc request size 4294967294
SQL state: XX000

Change History (8)

comment:1 by colivier, 14 years ago

Owner: changed from pramsey to colivier

select ST_AsSVG(ST_Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 2 0,0 2 )'::geometry));

st_assvg


~\x7F\x7F\x7F\x7F\x7F\x7F\x7F

On POSTGIS="1.5.0SVN" GEOS="3.1.0-CAPI-1.5.0" PROJ="Rel. 4.6.1, 21 August 2008" LIBXML="2.7.3" USE_STATS

Other ST_As* function work well on same geometry

comment:2 by colivier, 14 years ago

Paul,

Could you try this patch on your version ?

On my box it's fix this issue, but i did't have the same error message than yours (i don't get why you have a such high memory allocation)

Index: postgis/lwgeom_svg.c
===================================================================
--- postgis/lwgeom_svg.c	(revision 5208)
+++ postgis/lwgeom_svg.c	(working copy)
@@ -475,6 +475,8 @@
 	if ( i ) /* We have some geometries, so add space for delimiters. */ 
 		size += sizeof(";") * --i;
 
+	if (size == 0) size++; /* EMPTY GEOMETRYCOLLECTION */
+
 	return size;
 }
 
@@ -486,6 +488,9 @@
 	LWGEOM_INSPECTED *subinsp;
 	uchar *subgeom;
 
+	/* EMPTY GEOMETRYCOLLECTION */
+	if (insp->ngeometries == 0) *ptr = '\0';
+
 	for (i=0; i<insp->ngeometries; i++)
 	{
 		if (i) ptr += sprintf(ptr, ";");

Both 1.4 and trunk are impacted

comment:3 by colivier, 14 years ago

Friday evening side effect, i thought Paul was the initial reporter..

I just commit the fix, and related unit test in branches 1.4, 1.5 and trunk.

sdikiy is it possible for you to check with the latest 1.4 SVN branch ?

svn co http://svn.osgeo.org/postgis/branches/1.4/ postgis-1.4
cd postgis-1.4
sh autogen.sh
./configure && make 
export PGUSER=postgres && make check

in reply to:  3 comment:4 by sdikiy, 14 years ago

Replying to colivier:

sdikiy is it possible for you to check with the latest 1.4 SVN branch ?

sorry, i have installed only windows Postrges PostGIS :-(

comment:5 by colivier, 14 years ago

Resolution: fixed
Status: newclosed

Ok i close the ticket in this case

Tks for the report sdikiy !

comment:6 by robe, 14 years ago

Sdikiy,

As Olivier, noted. Please give the windows experimental 1.4.2SVN a try. It should have this fix in it.

http://www.postgis.org/download/windows/experimental.php

You should be able to do fine by just replacing your lib/postgis-1.4.dll with the one packaged in the zip file. Back up your original postgis-1.4.dll beforehand.

comment:7 by robe, 14 years ago

Milestone: PostGIS 1.4.2

in reply to:  6 comment:8 by sdikiy, 14 years ago

Note: See TracTickets for help on using tickets.