From 8550f3141c0b6ebe7edb70e0f8b039111da94cdb Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Thu, 8 Sep 2022 04:43:39 +1000 Subject: [PATCH] Fixed bounds error --- source/lib_builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/lib_builtin.c b/source/lib_builtin.c index f3ca621..151f11a 100644 --- a/source/lib_builtin.c +++ b/source/lib_builtin.c @@ -737,7 +737,7 @@ int _index(Interpreter* interpreter, LiteralArray* arguments) { //copy compound into result int resultIndex = 0; - for (int i = min; i >= lower && i <= AS_INTEGER(second); i += AS_INTEGER(third)) { + for (int i = min; i >= 0 && i >= lower && i <= AS_INTEGER(second); i += AS_INTEGER(third)) { result[ resultIndex++ ] = AS_STRING(compound)[ i ]; }