vm.c: check if target_class is NULL (when prepended).
Address CVE-2022-1427
MODIFY
src/vm.c
src/vm.c
@@ -1753,10 +1753,7 @@ RETRY_TRY_BLOCK:
mrb_exc_set(mrb, exc);
goto L_RAISE;
}
- if (target_class->flags & MRB_FL_CLASS_IS_PREPENDED) {
- target_class = mrb_vm_ci_target_class(ci);
- }
- else if (target_class->tt == MRB_TT_MODULE) {
+ if ((target_class->flags & MRB_FL_CLASS_IS_PREPENDED) || target_class->tt == MRB_TT_MODULE) {
target_class = mrb_vm_ci_target_class(ci);
if (!target_class || target_class->tt != MRB_TT_ICLASS) {
goto super_typeerror;

vm.c: check if target_class is NULL (when prepended).

Address CVE-2022-1427