Re: ogr2ogr with missing geometries crashes postgresql with segmentation fault

Jorge Gustavo Rocha <[email protected]> Tue, 16 Dec 2025 00:55:02 +0000
Newsgroups gmane.comp.gis.postgis
Message-ID <[email protected]>
--------------KK2RBM3PKusdCN3D6XjddUBF
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Amazing work, Paul!

Thank you,

Jorge

Às 00:35 de 16/12/25, Paul Ramsey escreveu:
> Should be fixed in all stable branches and going forward.
>
> On Mon, Dec 15, 2025 at 9:15 AM Paul Ramsey 
> <[email protected]> wrote:
>
>     I have started a ticket, and have a fix in hand.
>
>     https://trac.osgeo.org/postgis/ticket/6028
>
>     On Sat, Dec 13, 2025 at 6:28 PM Paul Ramsey
>     <[email protected]> wrote:
>
>         First, thank you for a perfect minimal reproducer right up
>         front. Very helpful and I have confirmed a crash here too. I
>         haven’t put it into the debugger yet. Your empty polygon is
>         pretty cool (as polygons tend to be) since it is not a classic
>         “polygon with no rings” empty polygon, it is a “polygon with
>         one ring that has no points” empty polygon.
>
>           01 // LITTLE ENDIAN.
>           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.
>         Anyways, very exciting to have a crasher, quite a rare defect
>         these days.
>         ATB,
>         P.
>
>
>>         On Dec 12, 2025, at 5:19 PM, Jorge Gustavo Rocha
>>         <[email protected]> wrote:
>>
>>         TL;DR
>>
>>         A GIST index on a EMPTY POLYGON (encoded by GDAL) crashes
>>         postgresql with segmentation fault.
>>
>>         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);
>
--------------KK2RBM3PKusdCN3D6XjddUBF
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Amazing work, Paul!</p>
    <p>Thank you,</p>
    <p>Jorge</p>
    <div class="moz-cite-prefix">Às 00:35 de 16/12/25, Paul Ramsey
      escreveu:<br>
    </div>
    <blockquote type="cite" cite="mid:CACowWR2s40YuLnUJNM4u5-xFxMEcjguUdC3iLOW8XZ7vWTMNFQ@mail.gmail.com">
      
      <div dir="ltr">
        <div>Should be fixed in all stable branches and going forward.</div>
        <br>
        <div class="gmail_quote gmail_quote_container">
          <div dir="ltr" class="gmail_attr">On Mon, Dec 15, 2025 at
            9:15 AM Paul Ramsey &lt;<a href="mailto:[email protected]" moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>&gt;
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
            <div dir="ltr">I have started a ticket, and have a fix in
              hand.
              <div><br>
              </div>
              <div><a href="https://trac.osgeo.org/postgis/ticket/6028" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://trac.osgeo.org/postgis/ticket/6028</a><br>
              </div>
            </div>
            <br>
            <div class="gmail_quote">
              <div dir="ltr" class="gmail_attr">On Sat, Dec 13, 2025 at
                6:28 PM Paul Ramsey &lt;<a href="mailto:[email protected]" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>&gt;
                wrote:<br>
              </div>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
                <div style="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’t put it into the debugger yet. Your empty
                  polygon is pretty cool (as polygons tend to be) since
                  it is not a classic “polygon with no rings” empty
                  polygon, it is a “polygon with one ring that has no
                  points” 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="cite">
                        <div>On Dec 12, 2025, at 5:19 PM, Jorge Gustavo
                          Rocha &lt;<a href="mailto:[email protected]" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>&gt;
                          wrote:</div>
                        <br>
                        <div><span style="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;text-decoration:none;float:none;display:inline">TL;DR</span><br style="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;text-decoration:none">
                          <br style="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;text-decoration:none">
                          <span style="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;text-decoration:none;float:none;display:inline">A
                            GIST index on a EMPTY POLYGON (encoded by
                            GDAL) crashes postgresql with segmentation
                            fault.</span><br style="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;text-decoration:none">
                          <br style="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;text-decoration:none">
                          <span style="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;text-decoration:none;float:none;display:inline">drop
                            table if exists fault;</span><br style="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;text-decoration:none">
                          <span style="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;text-decoration:none;float:none;display:inline">create
                            table fault (fid integer, geom
                            geometry(Polygon,5015));</span><br style="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;text-decoration:none">
                          <span style="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;text-decoration:none;float:none;display:inline">INSERT
                            INTO fault (fid, geom) VALUES (1,
                            '0103000020971300000100000000000000'::GEOMETRY);</span><br style="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;text-decoration:none">
                          <span style="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;text-decoration:none;float:none;display:inline">CREATE
                            INDEX fault_geom_index ON fault USING GIST
                            (geom);</span><br style="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;text-decoration:none">
                        </div>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </body>
</html>

--------------KK2RBM3PKusdCN3D6XjddUBF--