summaryrefslogtreecommitdiffhomepage
path: root/src/class.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-01-12 21:43:23 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-01-12 21:43:23 +0900
commit38acb9ec36bdd56123e6680885499fbf7f729f21 (patch)
treed6c27186d83a331d07ad3fd0106bc41b27434d4f /src/class.c
parent41eff635bf1e592ed71cca4e98136e09b637fbc1 (diff)
downloadmruby-38acb9ec36bdd56123e6680885499fbf7f729f21.tar.gz
mruby-38acb9ec36bdd56123e6680885499fbf7f729f21.zip
Kernel#initialize should not break existing mt; fix #3397
This issue was reported by https://hackerone.com/icanthack The solution is suggested by @clayton-shopify.
Diffstat (limited to 'src/class.c')
-rw-r--r--src/class.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/class.c b/src/class.c
index cb7bdfddd..45827f5ba 100644
--- a/src/class.c
+++ b/src/class.c
@@ -915,7 +915,9 @@ boot_defclass(mrb_state *mrb, struct RClass *super)
static void
boot_initmod(mrb_state *mrb, struct RClass *mod)
{
- mod->mt = kh_init(mt, mrb);
+ if (!mod->mt) {
+ mod->mt = kh_init(mt, mrb);
+ }
}
static struct RClass*