From b2e95aa882ebf2e7dd6554593c9271b944f52c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 24 Dec 2022 14:07:03 +0100 Subject: [PATCH] Prevent Add(), Remove() and Resize() methods on read-only arrays. [INTERPRETER] * BUG: Prevent Add(), Remove() and Resize() methods on read-only arrays. --- main/gbx/gbx_c_array.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/gbx/gbx_c_array.c b/main/gbx/gbx_c_array.c index e216d4a39..dc737ac0e 100644 --- a/main/gbx/gbx_c_array.c +++ b/main/gbx/gbx_c_array.c @@ -619,7 +619,7 @@ static bool copy_remove(CARRAY *_object, int start, int length, bool copy, bool return TRUE; } - if (remove && check_not_static(THIS)) + if (remove && check_not_static(THIS) && check_not_read_only(THIS)) return TRUE; if (check_start_length(count, &start, &length)) @@ -728,7 +728,7 @@ BEGIN_METHOD(Array_Resize, GB_INTEGER size) int size = VARG(size); - if (check_not_static(THIS) && check_not_multi(THIS)) + if (check_not_static(THIS) && check_not_multi(THIS) && check_not_read_only(THIS)) return; CARRAY_resize(THIS, size); @@ -886,7 +886,7 @@ static void add(CARRAY *_object, GB_VALUE *value, int index) { void *data; - if (check_not_static(THIS) && check_not_multi(THIS)) + if (check_not_static(THIS) && check_not_multi(THIS) && check_not_read_only(THIS)) return; data = insert(THIS, index);