Ticket #316 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

IsValid called on invalid 3d object leads to crash

Reported by: pramsey Owned by: mcayland
Priority: medium Milestone: PostGIS 1.5.0
Component: postgis Version: trunk
Keywords: Cc:

Description

Here's the offending SQL

select st_isvalid('POLYGON ((-97.78351581 36.37358796 1167.172,-97.78303556 36.37319923 1167.172,-98.88351581 38.37358796 1167.172))');

Solution should be back-ported into 1.4 also.

Change History

Changed 2 years ago by pramsey

The problem is in the parsing, not the validity check, so this fails too:

select 'POLYGON ((-97.78351581 36.37358796 1167.172,-97.78303556 36.37319923 1167.172,-98.88351581 38.37358796 1167.172))'::geometry;

Changed 2 years ago by pramsey

I can make it crash differently by adding a redundant point (and thereby passing through the minpoints test).

select 'POLYGON ((-97.78351581 36.37358796 1167.172,-97.78303556 36.37319923 1167.172,-97.78303556 36.37319923 1167.172,-98.88351581 38.37358796 1167.172))'::geometry;

Changed 2 years ago by pramsey

  • owner changed from pramsey to mcayland

Over to the parser master. That parser must go.

Changed 2 years ago by mcayland

  • status changed from new to closed
  • resolution set to fixed

I believe this is now fixed in 1.4 branch (r4902) and trunk (r4906). The short story is that due to the way the parser works, not all objects hold position information and so trying to display the error message was causing the crash. I've since altered the pop() function to ensure that the position is stored correctly in so-called "counting tuples" and then rebased the check functions to use these instead, except for the continuous curve check which seems to work slightly differently.

Please give this a thorough test as I'm slightly concerned that I may have missed a few cases.

Paul: I totally agree with you - this took much longer than it really should have done. I'll be the first one there standing in line with a pitchfork when the revolution comes.

Changed 2 years ago by pramsey

WRT the revolution, see the proto-parser in my defunct spike. In 2.0 I'm pulling this baby over.

 http://svn.osgeo.org/postgis/spike/pramsey/geodetic/liblwgeom/parse/

Changed 2 years ago by pramsey

Works for me on OS/X 64bit.

Note: See TracTickets for help on using tickets.