Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#1138 closed defect (fixed)

Crash on invalid GeoJSON input (GEOS compiled in Debug mode)

Reported by: caspervdw Owned by: rouault
Priority: major Milestone: 3.10.1
Component: Default Version: main
Severity: Significant Keywords:
Cc:

Description

I have been wrapping the new GeoJSON reader and writer in pygeos and encountered a few issues.

One issue is that GEOS crashes (aborts) on invalid geojson input ‘{“no”: “GeoJSON”}’. It seems that all places where a field is expected by the reader (e.g. “type”) the exception handling is not OK.

Change History (7)

comment:1 by caspervdw, 13 months ago

This issue is not reproducible on a CI runner (see https://github.com/pygeos/pygeos/pull/413)

I will investigate what is going wrong on my local build.

comment:2 by caspervdw, 13 months ago

So the crash only occurs when GEOS is built with "-DCMAKE_BUILD_TYPE=Debug".

When using -DCMAKE_BUILD_TYPE=Release, the issue goes away.

comment:3 by caspervdw, 13 months ago

Severity: UnassignedAnnoyance
Summary: Crash on invalid GeoJSON inputCrash on invalid GeoJSON input (GEOS compiled in Debug mode)

comment:4 by rouault, 13 months ago

Owner: changed from geos-devel@… to rouault
Severity: AnnoyanceSignificant

comment:5 by Even Rouault <even.rouault@…>, 13 months ago

Resolution: fixed
Status: newclosed

In c652f5b/git:

GeoJSON reader: fix crashes (in debug mode) on invalid GeoJSON

json::operator[] is advertised as having undefined behavior when the
request member doesn't exist or the json item is not an object.
json::at() is similar but emits a C++ exception on those situations.

Fixes #1138

comment:6 by Paul Ramsey <pramsey@…>, 13 months ago

In 9846ac3/git:

GeoJSON reader: fix crashes (in debug mode) on invalid GeoJSON

json::operator[] is advertised as having undefined behavior when the
request member doesn't exist or the json item is not an object.
json::at() is similar but emits a C++ exception on those situations.

Fixes #1138

comment:7 by caspervdw, 13 months ago

Thanks for the fix! I actually have triggered this issue now also with a Release build, on OSX.

Note: See TracTickets for help on using tickets.