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

segmentation fault from LineString.interpolate() #653

Closed
jGaboardi opened this issue Oct 30, 2018 · 5 comments
Closed

segmentation fault from LineString.interpolate() #653

jGaboardi opened this issue Oct 30, 2018 · 5 comments
Labels
Milestone

Comments

@jGaboardi
Copy link
Contributor

jGaboardi commented Oct 30, 2018

@snorfalorpagus, here you go:

Expected behavior and actual behavior.

Should throw a traceback or warning when attempting to interpolate a point along a LINESTRING EMPTY object, but instead crashes the kernel.

Steps to reproduce the problem

  • gist in notebook that results in a dead kernel (and see .png end of issue report)
  • this code chunk (below) results in a segmentation fault:
# python shapely_interpolate_segmentation_fault.py
import faulthandler
faulthandler.enable()
from shapely.geometry import Point, LineString
test_line = LineString(((0,0), (1,1), (2,1)))
print(test_line)
empty_line = test_line.parallel_offset(10., side='right')
print(empty_line)
empty_line.interpolate(.5, normalized=True)
$ python shapely_interpolate_segmentation_fault.py
LINESTRING (0 0, 1 1, 2 1)
LINESTRING EMPTY
Fatal Python error: Segmentation fault

Current thread 0x000000010ce7f5c0 (most recent call first):
  File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/linref.py", line 22 in __call__
  File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/geometry/base.py", line 777 in interpolate
  File "/Users/user/miniconda3/envs/py3_at1866/lib/python3.6/site-packages/shapely/impl.py", line 37 in wrapper
  File "shapely_interpolate_segmentation_fault.py", line 9 in <module>
Segmentation fault: 11

Operating system

  • Mac OS X 10.14

Shapely version and provenance

  • 1.6b4 installed from conda

dead_kernel

@kannes
Copy link
Contributor

kannes commented Nov 1, 2018

Hm, there is a exceptNull decorator but it does not seem to be used a lot. Might be perfect here?

https://github.com/Toblerity/Shapely/blob/master/shapely/geometry/base.py#L160

https://github.com/Toblerity/Shapely/search?q=exceptnull&unscoped_q=exceptnull

@snorfalorpagus
Copy link
Member

@kannes I think the excepNull decorator is the right thing to use. Do you want to submit a PR?

@jGaboardi
Copy link
Contributor Author

@snorfalorpagus @kannes I can submit the PR. Would it simply be adding the exceptNull decorator to interpolate?

@snorfalorpagus
Copy link
Member

snorfalorpagus commented Nov 3, 2018

+ a simple unit test

@jGaboardi
Copy link
Contributor Author

OK. I will try to get it submitted today.

Sent with GitHawk

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

4 participants