From 0e30aec98d00c19b7d110d3dcf8f13408252d051 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Mon, 22 Sep 2014 21:23:58 +0200 Subject: [PATCH] Degenerate floats cast to int can do amazing things. --- math/mathcore/src/AdaptiveIntegratorMultiDim.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/math/mathcore/src/AdaptiveIntegratorMultiDim.cxx b/math/mathcore/src/AdaptiveIntegratorMultiDim.cxx index 85a61b8..2757150 100644 --- a/math/mathcore/src/AdaptiveIntegratorMultiDim.cxx +++ b/math/mathcore/src/AdaptiveIntegratorMultiDim.cxx @@ -345,6 +345,11 @@ L160: //to divide or not ctr[j] = wk[isbtmp]; wth[j] = wk[isbtmp-1]; } + if (idvax0 < 1) { + // Can happen for overflows / degenerate floats. + idvax0 = 1; + ::Error("AdaptiveIntegratorMultiDim::DoIntegral()", "Logic error: idvax0 < 1!"); + } wth[idvax0-1] = 0.5*wth[idvax0-1]; ctr[idvax0-1] -= wth[idvax0-1]; goto L20; -- 1.8.2