GeoLatte / geolatte-geom

A geometry model that conforms to the OGC Simple Features for SQL specification.
Other
134 stars 63 forks source link

Infinite loop in WKT parser with invalid polygon #31

Closed ssaarela closed 9 years ago

ssaarela commented 9 years ago

An invalid polygon causes WKT parser to loop until heap size is reached. E.g.

Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1).decode("POLYGON( 24.881973486328125 60.15671327918588, 24.936218481445312 60.160642536827424, 24.978103857421875 60.16696253094966, 24.881973486328125 60.15671327918588 )");

maesenka commented 9 years ago

Could you post the stacktrace? On Mar 12, 2015 8:12 AM, "Samppa Saarela" notifications@github.com wrote:

An invalid polygon causes WKT parser to loop until heap size is reached. E.g.

Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1).decode("POLYGON( 24.881973486328125 60.15671327918588, 24.936218481445312 60.160642536827424, 24.978103857421875 60.16696253094966, 24.881973486328125 60.15671327918588 )");

— Reply to this email directly or view it on GitHub https://github.com/GeoLatte/geolatte-geom/issues/31.

ssaarela commented 9 years ago

Getting a stack trace takes quite a lot of time to fill the heap, but I debugged it to

PostgisWktDecoder#179: while (!matchesCloseList())

decodeLinearRingText() returns empty LinearRings for ever.

maesenka commented 9 years ago

Thanks, that’s what I needed.

On 12 Mar 2015, at 09:52, Samppa Saarela notifications@github.com wrote:

Getting a stack trace takes quite a lot of time to fill the heap, but I debugged it to

PostgisWktDecoder#179: while (!matchesCloseList())

decodeLinearRingText() returns empty LinearRings for ever.

— Reply to this email directly or view it on GitHub.

maesenka commented 9 years ago

Fixed in commit 2e2cb120f1fc20ac55d955dee8992f02f8a56ed4 and pushed as version 0.15