mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix bounds checking on slices for constant parameters
This commit is contained in:
+2
-2
@@ -2851,9 +2851,9 @@ bool check_index_value(CheckerContext *c, bool open_range, Ast *index_value, i64
|
|||||||
if (value) *value = v;
|
if (value) *value = v;
|
||||||
bool out_of_bounds = false;
|
bool out_of_bounds = false;
|
||||||
if (open_range) {
|
if (open_range) {
|
||||||
out_of_bounds = v >= max_count+1;
|
|
||||||
} else {
|
|
||||||
out_of_bounds = v >= max_count;
|
out_of_bounds = v >= max_count;
|
||||||
|
} else {
|
||||||
|
out_of_bounds = v >= max_count+1;
|
||||||
}
|
}
|
||||||
if (v < 0) {
|
if (v < 0) {
|
||||||
out_of_bounds = true;
|
out_of_bounds = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user