Blob Blame History Raw
commit 013532fe8f7b960dd50716c858dc83370e7dbe64
Author: Alejandro Alvarez Ayllon <a.alvarezayllon@gmail.com>
Date:   Tue Jul 21 11:06:52 2020 +0200

    Fix out-of-bounds access on FluxRadiusTask
    
    Generates a SIGABRT in Fedora 33. Could be reproduced with Valgrind.

diff --git a/SEImplementation/src/lib/Plugin/FluxRadius/FluxRadiusTask.cpp b/SEImplementation/src/lib/Plugin/FluxRadius/FluxRadiusTask.cpp
index 4a27ebb5..3c31cafa 100644
--- a/SEImplementation/src/lib/Plugin/FluxRadius/FluxRadiusTask.cpp
+++ b/SEImplementation/src/lib/Plugin/FluxRadius/FluxRadiusTask.cpp
@@ -51,6 +51,9 @@ void FluxRadiusTask::computeProperties(SourceInterface& source) const {
       // >= the target flux, and interpolate with the previous one
       auto next = std::find_if(std::begin(growth_curve), std::end(growth_curve),
                                std::bind2nd(std::greater_equal<double>(), target_flux));
+      if (next == std::end(growth_curve)) {
+        --next;
+      }
       size_t next_i = std::distance(std::begin(growth_curve), next);
 
       SeFloat y0, y1;