From 08c490d9ac7843227c6dab2ca21e51b747fc547d Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 15 Jul 2019 22:26:51 +0100 Subject: [PATCH] Fix bounds checking on slices for constant parameters --- src/check_expr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 6845c167d..4c5ca2348 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -2851,9 +2851,9 @@ bool check_index_value(CheckerContext *c, bool open_range, Ast *index_value, i64 if (value) *value = v; bool out_of_bounds = false; if (open_range) { - out_of_bounds = v >= max_count+1; - } else { out_of_bounds = v >= max_count; + } else { + out_of_bounds = v >= max_count+1; } if (v < 0) { out_of_bounds = true;