Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when calling shapely.geometry.asShape with invalid geometry #546

Closed
pvalsecc opened this issue Nov 20, 2017 · 4 comments
Closed

Crash when calling shapely.geometry.asShape with invalid geometry #546

pvalsecc opened this issue Nov 20, 2017 · 4 comments
Labels
Milestone

Comments

@pvalsecc
Copy link

pvalsecc commented Nov 20, 2017

Expected behavior and actual behavior.

This code:

import shapely.geometry
x = shapely.geometry.asShape({'coordinates': [[1130.0, 1110.0]], 'type': 'LineString'})
assert x.is_valid
x.wkb

First, is_valid returns True instead of False and I see this log when calling it:

IllegalArgumentException: point array must contain 0 or >1 elements

Then, when asking for the wkb, my python process crashes which is even worse:

python3.5: geos_ts_c.cpp:5240: unsigned char* GEOSWKBWriter_write_r(GEOSContextHandle_t, geos::io::WKBWriter*, const geos::geom::Geometry*, std::size_t*): Assertion `0 != geom' failed.
Aborted (core dumped)

Steps to reproduce the problem.

import shapely.geometry
x = shapely.geometry.asShape({'coordinates': ((1130.0, 1110.0),), 'type': 'LineString'})
assert not x.is_valid
x.wkb

Operating system

Ubuntu Xenial. python 3.5.2.

Shapely version and provenance

1.6.2 from pypi

@sgillies sgillies added the bug label Nov 20, 2017
@sgillies sgillies added this to the 1.6.3 milestone Nov 20, 2017
@sgillies
Copy link
Contributor

Thanks for the report @pvalsecc. Looks like it is related to #509.

@pvalsecc
Copy link
Author

Yep, indeed. I'm a bit surprised by how long it's been around, though.

sgillies added a commit that referenced this issue Dec 9, 2017
@sgillies
Copy link
Contributor

sgillies commented Dec 9, 2017

Resolved. The fix will be in 1.6.3.

@sgillies sgillies closed this as completed Dec 9, 2017
@padilla0
Copy link

hi, i try with 1.7.0 and nothing. then return to 1.6.3 and its fixed..... its sad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants