Skip to content

Commit

Permalink
Fix C-API null pointer deref on col (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
sangshuduo authored and pramsey committed Oct 24, 2024
1 parent 631bf0e commit d630386
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions capi/geos_ts_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ extern "C" {
{
return execute(extHandle, [&]() {
BufferParameters bp;
//-- use default cap style ROUND
//-- use default cap style ROUND
bp.setQuadrantSegments(quadsegs);

if(joinStyle > BufferParameters::JOIN_BEVEL) {
Expand Down Expand Up @@ -2069,10 +2069,11 @@ extern "C" {
GeometryCollection *col = dynamic_cast<GeometryCollection*>(collection);
if (!col) {
handle->ERROR_MESSAGE("Parameter collection of GEOSGeom_releaseCollection_r must not be a collection");
} else {
*ngeoms = static_cast<unsigned int>(col->getNumGeometries());
}

// Early exit on empty/null input
*ngeoms = static_cast<unsigned int>(col->getNumGeometries());
if (!col || *ngeoms == 0) {
return static_cast<Geometry**>(nullptr);
}
Expand Down

0 comments on commit d630386

Please sign in to comment.