Opened 9 months ago

Closed 8 months 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 Changed 8 months ago by pramsey

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 Changed 8 months ago by Algunenano

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 Changed 8 months ago by Raul Marin

In 17174:

Avoid passing a NULL pointer to GEOSisEmpty

References #4275

comment:4 Changed 8 months ago by Raul Marin

In 17175:

Avoid passing a NULL pointer to GEOSisEmpty

References #4275

comment:5 Changed 8 months ago by Raul Marin

In 17176:

Avoid passing a NULL pointer to GEOSisEmpty

References #4275

comment:6 Changed 8 months ago by Raul Marin

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.