Opened 2 years ago

Closed 2 years ago

Last modified 2 years 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, 2 years 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, 2 years 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, 2 years ago

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

comment:4 by rouault, 2 years ago

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

comment:5 by Even Rouault <even.rouault@…>, 2 years 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@…>, 2 years 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, 2 years 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.