Re: ogr2ogr with missing geometries crashes postgresql with segmentation fault

Paul Ramsey via postgis-users <[email protected]> Sat, 13 Dec 2025 18:28:09 -0800
Newsgroups gmane.comp.gis.postgis
Message-ID <[email protected]>
--Apple-Mail=_99138CB8-92B8-499B-B8E6-5832C25FA00C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

First, thank you for a perfect minimal reproducer right up front. Very =
helpful and I have confirmed a crash here too. I haven=E2=80=99t put it =
into the debugger yet. Your empty polygon is pretty cool (as polygons =
tend to be) since it is not a classic =E2=80=9Cpolygon with no rings=E2=80=
=9D empty polygon, it is a =E2=80=9Cpolygon with one ring that has no =
points=E2=80=9D empty polygon.

  01 // LITTLE ENDIAN.=20
  03000020 // POLYGON, WITH SRID
  97130000 // SRID 5015
  01000000 // ONE RING
  00000000 // ZERO POINTS

Why that causes a crash in the index code (or perhaps the bounding box =
extraction code) is yet to be determined.=20
Anyways, very exciting to have a crasher, quite a rare defect these =
days.
ATB,
P.


> On Dec 12, 2025, at 5:19=E2=80=AFPM, Jorge Gustavo Rocha =
<[email protected]> wrote:
>=20
> TL;DR
>=20
> A GIST index on a EMPTY POLYGON (encoded by GDAL) crashes postgresql =
with segmentation fault.
>=20
> drop table if exists fault;
> create table fault (fid integer, geom geometry(Polygon,5015));
> INSERT INTO fault (fid, geom) VALUES (1, =
'0103000020971300000100000000000000'::GEOMETRY);
> CREATE INDEX fault_geom_index ON fault USING GIST (geom);


--Apple-Mail=_99138CB8-92B8-499B-B8E6-5832C25FA00C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;">First, thank =
you for a perfect minimal reproducer right up front. Very helpful and I =
have confirmed a crash here too. I haven=E2=80=99t put it into the =
debugger yet. Your empty polygon is pretty cool (as polygons tend to be) =
since it is not a classic =E2=80=9Cpolygon with no rings=E2=80=9D empty =
polygon, it is a =E2=80=9Cpolygon with one ring that has no points=E2=80=9D=
 empty polygon.<div><br></div><div><div>&nbsp; 01 // LITTLE =
ENDIAN.&nbsp;</div><div>&nbsp; 03000020 // POLYGON, WITH =
SRID</div><div>&nbsp; 97130000 // SRID 5015</div><div>&nbsp; 01000000 // =
ONE RING</div><div>&nbsp; 00000000 // ZERO =
POINTS</div><div><br></div><div>Why that causes a crash in the index =
code (or perhaps the bounding box extraction code) is yet to be =
determined.&nbsp;</div><div>Anyways, very exciting to have a crasher, =
quite a rare defect these =
days.</div><div>ATB,</div><div>P.</div><div><br></div><div><br><blockquote=
 type=3D"cite"><div>On Dec 12, 2025, at 5:19=E2=80=AFPM, Jorge Gustavo =
Rocha &lt;[email protected]&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div><span style=3D"caret-color: =
rgb(0, 0, 0); font-family: HelveticaNeue; font-size: 13px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline =
!important;">TL;DR</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HelveticaNeue; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HelveticaNeue; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: HelveticaNeue; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">A GIST =
index on a EMPTY POLYGON (encoded by GDAL) crashes postgresql with =
segmentation fault.</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HelveticaNeue; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HelveticaNeue; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: HelveticaNeue; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">drop =
table if exists fault;</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: HelveticaNeue; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: HelveticaNeue; font-size: 13px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">create =
table fault (fid integer, geom geometry(Polygon,5015));</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HelveticaNeue; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HelveticaNeue; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">INSERT INTO fault (fid, =
geom) VALUES (1, =
'0103000020971300000100000000000000'::GEOMETRY);</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HelveticaNeue; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
HelveticaNeue; font-size: 13px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">CREATE INDEX =
fault_geom_index ON fault USING GIST (geom);</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: HelveticaNeue; =
font-size: 13px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"></div></blockquote></div><br></div></body></html>=

--Apple-Mail=_99138CB8-92B8-499B-B8E6-5832C25FA00C--