Fix bounds checking on slices for constant parameters

This commit is contained in:
gingerBill
2019-07-15 22:26:51 +01:00
parent 8ee7ee7120
commit 08c490d9ac

View File

@@ -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;