Re: BUG #13334: PostGIS 2.2 crash in topology (array_contain_compare) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #13334: PostGIS 2.2 crash in topology (array_contain_compare)
Date
Msg-id 14779.1432333523@sss.pgh.pa.us
Whole thread Raw
In response to BUG #13334: PostGIS 2.2 crash in topology (array_contain_compare)  (lr@pcorp.us)
List pgsql-bugs
lr@pcorp.us writes:
> Since May 9th our Debian build bot has been crashing on one of our PostGIS
> regression tests.

> I tried the same exercise on my Mingw-w64 GCC 4.8.3 (with latest PostgreSQL
> 9.5 - (dated 5/22) and also have crashing in same spot.

> I isoloated the offending query in PostGIS to this:

> with inp as ( select 'MULTIPOINT((0 -10),(5 -10))' ::geometry as g)
> select St_AsText(g), ST_Equals(totopogeom(g, 'tt', 1)::geometry, g) from
> inp;

> Which produces a gdb backtrace:

> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 4252.0x3cf4]
> array_contain_compare (array1=array1@entry=0xdd94200,
> array2=array2@entry=0xde69db8, collation=<optimized out>,
> matchall=matchall@entry=1 '\001', fn_extra=0xdeac920) at arrayfuncs.c:4116
> 4116                            if (isnull2)

Hm.  Just guessing from the location of the crash, but I'll bet I
overlooked the case of an expanded array with no nulls, ie should be

-            bool        isnull2 = nulls2[j];
+            bool        isnull2 = nulls2 ? nulls2[j] : false;

I'll commit that in a few minutes, please confirm whether it fixes this
for you.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: pg_upgrade slowness for databases with many tables
Next
From: chris@chrullrich.net
Date:
Subject: BUG #13336: Unexpected result from invalid query