]> granicus.if.org Git - postgis/commitdiff
Guard against zero'd histo edge, but also avoid arbitrarily inflating edge
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 12 Apr 2019 19:45:33 +0000 (19:45 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 12 Apr 2019 19:45:33 +0000 (19:45 +0000)
References #4362

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

postgis/gserialized_estimate.c

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