Prevent Add(), Remove() and Resize() methods on read-only arrays.

[INTERPRETER]
* BUG: Prevent Add(), Remove() and Resize() methods on read-only arrays.
This commit is contained in:
Benoît Minisini 2022-12-24 14:07:03 +01:00
parent a06edadf8c
commit b2e95aa882

View file

@ -619,7 +619,7 @@ static bool copy_remove(CARRAY *_object, int start, int length, bool copy, bool
return TRUE; return TRUE;
} }
if (remove && check_not_static(THIS)) if (remove && check_not_static(THIS) && check_not_read_only(THIS))
return TRUE; return TRUE;
if (check_start_length(count, &start, &length)) if (check_start_length(count, &start, &length))
@ -728,7 +728,7 @@ BEGIN_METHOD(Array_Resize, GB_INTEGER size)
int size = VARG(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; return;
CARRAY_resize(THIS, size); CARRAY_resize(THIS, size);
@ -886,7 +886,7 @@ static void add(CARRAY *_object, GB_VALUE *value, int index)
{ {
void *data; 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; return;
data = insert(THIS, index); data = insert(THIS, index);