From f7ee098625881d79d48cb494534035fe15f24e41 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Fri, 12 Apr 2019 19:45:33 +0000 Subject: [PATCH] Guard against zero'd histo edge, but also avoid arbitrarily inflating edge References #4362 git-svn-id: http://svn.osgeo.org/postgis/trunk@17384 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/gserialized_estimate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/postgis/gserialized_estimate.c b/postgis/gserialized_estimate.c index b273cdcb4..6a695841c 100644 --- a/postgis/gserialized_estimate.c +++ b/postgis/gserialized_estimate.c @@ -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]; } -- 2.40.0