]> granicus.if.org Git - postgis/commitdiff
Fix crash on NULL item in ND index (#1734)
authorSandro Santilli <strk@keybit.net>
Thu, 29 Mar 2012 12:37:42 +0000 (12:37 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 29 Mar 2012 12:37:42 +0000 (12:37 +0000)
Add regression testing for the case

git-svn-id: http://svn.osgeo.org/postgis/trunk@9577 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/gserialized_gist_nd.c
regress/tickets.sql
regress/tickets_expected

index fccfe705f73add5647a9a6d297b6453d85de7207..8d4e4a89d4fddafb2f77c196c9eb9cfc6a7696c6 100644 (file)
@@ -212,17 +212,17 @@ static float gidx_union_volume(GIDX *a, GIDX *b)
                return 0.0;
        }
 
-       if ( gidx_is_unknown(a) && gidx_is_unknown(b) )
-       {
-               return 0.0;
-       }
-               
        if ( a == NULL || gidx_is_unknown(a) )
                return gidx_volume(b);
 
        if ( b == NULL || gidx_is_unknown(b) )
                return gidx_volume(a);
 
+       if ( gidx_is_unknown(a) && gidx_is_unknown(b) )
+       {
+               return 0.0;
+       }
+
        /* Ensure 'a' has the most dimensions. */
        gidx_dimensionality_check(&a, &b);
 
index fffa365249117f97ae599fed2bf949438c931467..c90756fba2914ddab39466aae6f34cdc9856247f 100644 (file)
@@ -644,5 +644,15 @@ SELECT '#1697.2', count(*) FROM eg WHERE gm && 'POINT(0 0)'::geometry;
 SELECT '#1697.3', count(*) FROM eg WHERE gm ~= 'POINT EMPTY'::geometry;
 DROP TABLE eg;
 
+-- #1734 --
+create table eg (g geography);
+create index egi on eg using gist (g);
+INSERT INTO eg(g) VALUES (NULL);
+INSERT INTO eg (g) VALUES ('POINT(0 0)'::geography);
+INSERT INTO eg (g) select 'POINT(0 0)'::geography
+       FROM generate_series(1,1024);
+SELECT '#1734.1', count(*) FROM eg;
+DROP table eg;
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
index 07ee581babb43d216f8e251ed09fff4b9afb22e6..6375178600ee86e91e68470260765a583a0c03f5 100644 (file)
@@ -213,3 +213,4 @@ NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
 #1697.1|0
 #1697.2|0
 #1697.3|1024
+#1734.1|1026