Fix constant out of bounds bug
This commit is contained in:
1 parent
f24de51c65
commit
7e271310ff
1 file changed
+4
-5
+4
-5
@@ -3119,13 +3119,12 @@ 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;
|
||||
} else {
|
||||
out_of_bounds = v >= max_count+1;
|
||||
}
|
||||
if (v < 0) {
|
||||
out_of_bounds = true;
|
||||
} else if (open_range) {
|
||||
out_of_bounds = v > max_count;
|
||||
} else {
|
||||
out_of_bounds = v >= max_count;
|
||||
}
|
||||
|
||||
if (out_of_bounds) {
|
||||
|
||||
Reference in new issue
Block a user