From 67e68e145f976eafdcc72c0441845ea13c13eabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 18 Aug 2017 14:59:21 +0200 Subject: [PATCH] [apps/statistics] Avoid infinite loop in histogram Change-Id: Ifd106d76628fe149c970f365eb0a92bc302f3b13 --- apps/statistics/histogram_parameter_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/statistics/histogram_parameter_controller.cpp b/apps/statistics/histogram_parameter_controller.cpp index fe1451982..dc3763a04 100644 --- a/apps/statistics/histogram_parameter_controller.cpp +++ b/apps/statistics/histogram_parameter_controller.cpp @@ -44,7 +44,7 @@ bool HistogramParameterController::setParameterAtIndex(int parameterIndex, doubl assert(parameterIndex >= 0 && parameterIndex < k_numberOfCells); if (parameterIndex == 0) { double newNumberOfBars = std::ceil((m_store->maxValue() - m_store->minValue())/f); - if (f <= 0.0f || newNumberOfBars > Store::k_maxNumberOfBars) { + if (f <= 0.0f || newNumberOfBars > Store::k_maxNumberOfBars || m_store->firstDrawnBarAbscissa() > m_store->maxValue()+f) { app()->displayWarning(I18n::Message::ForbiddenValue); return false; }