From: Paul Ramsey Date: Thu, 14 Sep 2017 22:57:54 +0000 (+0000) Subject: #3731, backend crash on stats object with zero-size histogram X-Git-Tag: 2.4.0rc2~46 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=296871a1ff7cd151d67bb6ba5019b201f2d534d3;p=postgis #3731, backend crash on stats object with zero-size histogram git-svn-id: http://svn.osgeo.org/postgis/trunk@15739 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/gserialized_estimate.c b/postgis/gserialized_estimate.c index ea343495b..a63bfff67 100644 --- a/postgis/gserialized_estimate.c +++ b/postgis/gserialized_estimate.c @@ -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]; }