From 0094b366369df9b76f8bcec3add854de43f9a967 Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Sat, 16 Apr 2016 12:25:29 -0700 Subject: [PATCH] fix bounds check to fix segfault reported in issue #565 Signed-off-by: Nikolaj Bjorner --- src/opt/opt_context.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opt/opt_context.cpp b/src/opt/opt_context.cpp index a28500568..b4dbb3dd5 100644 --- a/src/opt/opt_context.cpp +++ b/src/opt/opt_context.cpp @@ -1205,7 +1205,7 @@ namespace opt { } inf_eps context::get_lower_as_num(unsigned idx) { - if (idx > m_objectives.size()) { + if (idx >= m_objectives.size()) { throw default_exception("index out of bounds"); } objective const& obj = m_objectives[idx]; @@ -1223,7 +1223,7 @@ namespace opt { } inf_eps context::get_upper_as_num(unsigned idx) { - if (idx > m_objectives.size()) { + if (idx >= m_objectives.size()) { throw default_exception("index out of bounds"); } objective const& obj = m_objectives[idx];