From: Enblend <enb...@li...> - 2015-08-07 14:46:36
|
branch: stable-4_1 details: http://enblend.hg.sourceforge.net/hgweb/enblend/enblend/hg/p/enblend/code/rev/30eee34464bf changeset: 1257:30eee34464bf user: Chris <cs...@us...> date: Fri Aug 07 16:44:34 2015 +0200 description: Fix a possible domain error followed by a division-by-zero in GDAConfiguration. Found by Clang++'s ubsan. Transplant of change a6290d439c8a. diffstat: NEWS | 3 +++ VERSION | 2 +- src/anneal.h | 9 +++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diffs (38 lines): diff -r 24709d03d8bc -r 30eee34464bf NEWS --- a/NEWS Fri Aug 07 16:44:32 2015 +0200 +++ b/NEWS Fri Aug 07 16:44:34 2015 +0200 @@ -7,6 +7,9 @@ ** Bug Fixes +- [Enblend] Fix a possible domain error followed by a division-by-zero + in the seamline optimizer. + - [Enblend and Enfuse] Avoid an undeserved warning about incompatible colorspaces if they only disagree on their meta-data (e.g. profile creation date/time). diff -r 24709d03d8bc -r 30eee34464bf VERSION --- a/VERSION Fri Aug 07 16:44:32 2015 +0200 +++ b/VERSION Fri Aug 07 16:44:34 2015 +0200 @@ -1,1 +1,1 @@ -4.1.4-6ee2a6279fb9 +4.1.4-24709d03d8bc diff -r 24709d03d8bc -r 30eee34464bf src/anneal.h --- a/src/anneal.h Fri Aug 07 16:44:32 2015 +0200 +++ b/src/anneal.h Fri Aug 07 16:44:34 2015 +0200 @@ -231,8 +231,13 @@ deltaEMax = AnnealPara.deltaEMax; deltaEMin = AnnealPara.deltaEMin; const double kmax = static_cast<double>(kMax); - tInitial = ceil(deltaEMax / log(kmax / (kmax - 2.0))); - tFinal = deltaEMin / log(kmax * kmax - kmax - 1.0); + if (kmax > 2.5) { + tInitial = ceil(deltaEMax / log(kmax / (kmax - 2.0))); + tFinal = deltaEMin / log(kmax * kmax - kmax - 1.0); + } else { + tInitial = deltaEMax; + tFinal = deltaEMin; + } } ~GDAConfiguration() { |