aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-07-15 22:26:51 +0100
committergingerBill <bill@gingerbill.org>2019-07-15 22:26:51 +0100
commit08c490d9ac7843227c6dab2ca21e51b747fc547d (patch)
tree1c294cb27be3692b63a238c2009b1a15d0de2310 /src/check_expr.cpp
parent8ee7ee71200f93710b9b84ae305dd0f04aaf20b6 (diff)
Fix bounds checking on slices for constant parameters
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp4
1 files 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;