Opened 15 years ago

Closed 14 years ago

#417 closed defect (wontfix)

crash in parser

Reported by: strk Owned by: mcayland
Priority: blocker Milestone: PostGIS 1.5.2
Component: postgis Version: master
Keywords: Cc:

Description

# select '0102000000010000000000000000'::geometry; server closed the connection unexpectedly

This probably means the server terminated abnormally before or while processing the request.

The connection to the server was lost. Attempting reset: Failed. !>

1.4 and 1.5 are also affected

Change History (10)

comment:1 by kneufeld, 15 years ago

I don't have this problem using PostGIS 1.5.0. Instead, I get:

postgis=# select '0102000000010000000000000000'::geometry;
ERROR:  parse error - invalid geometry
LINE 1: select '0102000000010000000000000000'::geometry;
               ^
HINT:  You must specify a valid OGC WKT geometry type such as POINT, LINESTRING or POLYGON

comment:2 by robe, 15 years ago

On my 1.4.1 windows stack builder install, I get the same thing as Kevin.

ERROR: parse error - invalid geometry LINE 1: select '0102000000010000000000000000'::geometry;

HINT: You must specify a valid OGC WKT geometry type such as POINT, LINESTRING or POLYGON.

Sandro what OS are you running on? Wonder if its a 64-bit issue. I can try on my 64-bit Linux dev box later.

comment:3 by robe, 15 years ago

Correction.I think might be one of those heisenbugs. I tried again and got this but can't replicate it subsequent give Kevin's error. Doesn't crash though

ERROR:  parse error - invalid geometry
LINE 1: select '0102000000010000000000000000'::geometry;
               ^
HINT:  "..." <-- parse error at position 24903680 within geometry

********** Error **********

ERROR: parse error - invalid geometry
SQL state: XX000
Hint: "..." <-- parse error at position 24903680 within geometry

comment:4 by strk, 15 years ago

64bit indeed. Ubuntu 8.10.

comment:5 by pramsey, 15 years ago

Milestone: PostGIS 1.5.1

comment:6 by pramsey, 15 years ago

Fun, this looks like something I was just thinking about while writing a new WKB reader: what if the user feeds in WKB that doesn't match the contents of the memory segment? (Like claiming there are 5 coordinates when there are 0. You can then get the reader to walk merrily off the end of the memory segment.) Fixing this in the current parser looks very unpleasant. It is the unpleasantness of the current parse/unparse code that is actually driving me to write new ones, in fact.

comment:7 by pramsey, 15 years ago

Owner: changed from pramsey to mcayland

I'm going to give this to Mark as the person most likely to be able to fix it. It's been around a long time, but if anyone can fix it, it's Mark.

comment:8 by pramsey, 15 years ago

Once you starting exercising the WKB handler, knowing that it doesn't bounds-check, it dies all sorts of ways:

postgis15=# select '01'::geometry;
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> 

comment:9 by pramsey, 15 years ago

Milestone: PostGIS 1.5.1PostGIS 1.5.2

comment:10 by pramsey, 14 years ago

Resolution: wontfix
Status: newclosed

I am closing this ticket:

  • Fixing this will require gutting the parser and changing large chunks of it.
  • This issue will be fixed in 2.0, since the parser is getting gutted there anyways.
  • If someone comes with funding to do this work in 1.5, we can re-visit.
Note: See TracTickets for help on using tickets.