Opened 4 years ago

Closed 4 years ago

#4791 closed defect (fixed)

segfault in ST_Square

Reported by: tobwen Owned by: pramsey
Priority: critical Milestone: PostGIS 3.1.0
Component: postgis Version: master
Keywords: ST_Square, segfault, segmentation fault Cc:

Description

bug

I've written a small snippet to create single gridcells. After execution, PG's backend segfaults.

fix

RhodiumToad on Freenode helped me to debug it. Here's his result:

postgis/lwgeom_generate_grid.c: line 420, the PG_FREE_IF_COPY has a parameter number of 1, which is not the parameter the value came from, which is 3

so it tries to free something incorrectly and dies

affected versions

Seems like all 3.x versions are affected.

Change History (2)

comment:1 by tobwen, 4 years ago

Other functions might also be affected: ST_Hexagon (etc.) also has three arguments, but PG_FREE_IF_COPY(gorigin, 1); in code.

comment:2 by Algunenano, 4 years ago

Milestone: PostGIS 3.0.3PostGIS 3.1.0
Resolution: fixed
Status: newclosed
Version: 3.0.xmaster
Note: See TracTickets for help on using tickets.