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

LINESTRING EMPTY crashes duckdb spatial. #195

Closed
cuteDen-ECNU opened this issue Nov 24, 2023 · 1 comment · Fixed by #200
Closed

LINESTRING EMPTY crashes duckdb spatial. #195

cuteDen-ECNU opened this issue Nov 24, 2023 · 1 comment · Fixed by #200

Comments

@cuteDen-ECNU
Copy link

Hi, the following statement crashes duckdb spatial.

SELECT ST_PointOnSurface(ST_Collect([ST_GeomFromText('LINESTRING(0 0, 1 1)'), ST_GeomFromText('LINESTRING EMPTY')]))
--Segmentation fault (core dumped)

Using the function ST_AsText, I got the following result.

SELECT ST_AsText(ST_Collect([ST_GeomFromText('LINESTRING(0 0, 1 1)'), ST_GeomFromText('LINESTRING EMPTY')]))
-- [('MULTILINESTRING ((0 0, 1 1), ())',)]

Version:

The result of "pragma version;" is [('v0.9.2', '3c695d7ba9')]

I used "FORCE INSTALL spatial FROM 'http://nightly-extensions.duckdb.org';" in the Python client.

@Maxxen
Copy link
Member

Maxxen commented Nov 24, 2023

Hi! Thanks for reporting this issue! Testing with PostGIS it seems to crash there too!
Thankfully the fix is easy, we just need to check if the geometry is empty before we push it to the collection here:

auto geometry = lstate.factory.Deserialize(geometry_blob);
geometries.push_back(geometry);
}

Will include a fix next push!

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

Successfully merging a pull request may close this issue.

2 participants