Opened 7 years ago

Closed 7 years ago

Last modified 7 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 Changed 7 years ago by colivier

  • 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 Changed 7 years ago by colivier

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 follow-up: Changed 7 years ago by colivier

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

comment:4 in reply to: ↑ 3 Changed 7 years ago by sdikiy

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 Changed 7 years ago by colivier

  • Resolution set to fixed
  • Status changed from new to closed

Ok i close the ticket in this case

Tks for the report sdikiy !

comment:6 follow-up: Changed 7 years ago by robe

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 Changed 7 years ago by robe

  • Milestone set to PostGIS 1.4.2

comment:8 in reply to: ↑ 6 Changed 7 years ago by sdikiy

Note: See TracTickets for help on using tickets.