]> granicus.if.org Git - postgis/commitdiff
#3731, backend crash on stats object with zero-size histogram
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 14 Sep 2017 22:57:54 +0000 (22:57 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 14 Sep 2017 22:57:54 +0000 (22:57 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@15739 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/gserialized_estimate.c

index ea343495b0d08c974c4f68dbc6f8735c4aa6d746..a63bfff671cb033949801780ceb5e4976ad0a85c 100644 (file)
@@ -1561,7 +1561,7 @@ compute_gserialized_stats_mode(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfu
                histo_cells_new = 1;
                for ( d = 0; d < ndims; d++ )
                {
-                       histo_size[d] = (int)pow((double)histo_cells_target, 1/(double)ndims);
+                       histo_size[d] = 1 + (int)pow((double)histo_cells_target, 1/(double)ndims);
                        POSTGIS_DEBUGF(3, "   histo_size[d]: %d", histo_size[d]);
                        histo_cells_new *= histo_size[d];
                }