From e5839bb98ee4e011c43d01d0204f8c513dcd3c2e Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Mon, 31 Jan 2022 21:22:19 +0000 Subject: =?UTF-8?q?Make=20pick=20(=E2=8A=83)=20check=20that=20the=20index?= =?UTF-8?q?=20is=20within=20range?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions.c b/functions.c index e3987ff..4b93b44 100644 --- a/functions.c +++ b/functions.c @@ -1325,6 +1325,8 @@ fnPick(Array *left, Array *right) add *= result->shape[k]; index += add; } + if(index >= result->size) + throwerror(nil, EIndex); Array *tmp = result; result = arrayitem(result, index); freearray(tmp); -- cgit v1.2.3