Berry prevent crash when setting superclass of solidified class

This commit is contained in:
Stephan Hadinger 2021-12-01 21:54:00 +01:00
parent aab4dcdb6a
commit a147e00f6d
1 changed files with 6 additions and 1 deletions

View File

@ -984,7 +984,12 @@ newframe: /* a new call frame */
bvalue *a = RA(), *b = RKB();
if (var_isclass(a) && var_isclass(b)) {
bclass *obj = var_toobj(a);
be_class_setsuper(obj, var_toobj(b));
if (!gc_isconst(obj)) {
be_class_setsuper(obj, var_toobj(b));
} else {
vm_error(vm, "internal_error",
"cannot change superclass of a read-only class");
}
} else {
vm_error(vm, "type_error",
"value '%s' does not support set super",