Opened 5 years ago

Closed 5 years ago

#4275 closed defect (fixed)

Crash in GEOSisEmpty_r

Reported by: Algunenano Owned by: Algunenano
Priority: medium Milestone: PostGIS 2.4.7
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

We've recently had a crash pointing to GEOSisEmpty_r. Sadly I don't have a coredump nor a test to reproduce it yet, but after looking at the usages of GEOSisEmpty it looks like https://github.com/postgis/postgis/blob/80cfa0b0c050499518138a4a972a4033f2b347b7/liblwgeom/lwgeom_geos_clean.c#L701 could be the culprit, as it's passing the result of a function that might be NULL to GEOSisEmpty.

I'll see if I can reproduce it somehow locally.

Change History (6)

comment:1 by pramsey, 5 years ago

GEOSisEmpty looks like it'll just hand back a return value of '2' if passed a NULL, so not sure if that's it…?

comment:2 by Algunenano, 5 years ago

GEOSisEmpty looks like it'll just hand back a return value of '2' if passed a NULL, so not sure if that's it…?

No, it returns 2 if the geos handle (extHandle) is NULL, but it doesn't check g1 before dereferencing it. None of the other functions does this check, so I understand it's the intended behaviour.

I'm going to check all the usages of GEOSisEmpty and try to verify that none of them can pass a NULL pointer as geometry.

comment:3 by Raul Marin, 5 years ago

In 17174:

Avoid passing a NULL pointer to GEOSisEmpty

References #4275

comment:4 by Raul Marin, 5 years ago

In 17175:

Avoid passing a NULL pointer to GEOSisEmpty

References #4275

comment:5 by Raul Marin, 5 years ago

In 17176:

Avoid passing a NULL pointer to GEOSisEmpty

References #4275

comment:6 by Raul Marin, 5 years ago

Resolution: fixed
Status: assignedclosed

In 17177:

Avoid passing a NULL pointer to GEOSisEmpty

Closes #4275
Closes https://github.com/postgis/postgis/pull/362

Note: See TracTickets for help on using tickets.