Merge pull request #13888 from s-hadinger/berry_no_crash_setsuper

Berry prevent crash when setting superclass of solidified class
This commit is contained in:
s-hadinger 2021-12-01 22:02:36 +01:00 committed by GitHub
commit ed094301a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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",