diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-06-01 21:30:07 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-06-01 21:30:07 +0900 |
| commit | b6121adc7dbedcf0e6fd262de536c2f8c9217120 (patch) | |
| tree | 8b91750f1e347b324a5081cf9a07ddb72f7a771e | |
| parent | bd2686d82d233774003fe683e9396f366b152b6d (diff) | |
| download | mruby-b6121adc7dbedcf0e6fd262de536c2f8c9217120.tar.gz mruby-b6121adc7dbedcf0e6fd262de536c2f8c9217120.zip | |
singleton_class should not be duped; fix #2815
| -rw-r--r-- | src/kernel.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/kernel.c b/src/kernel.c index 9d056178e..b5b13f874 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -369,6 +369,9 @@ mrb_obj_dup(mrb_state *mrb, mrb_value obj) if (mrb_immediate_p(obj)) { mrb_raisef(mrb, E_TYPE_ERROR, "can't dup %S", obj); } + if (mrb_type(obj) == MRB_TT_SCLASS) { + mrb_raise(mrb, E_TYPE_ERROR, "can't dup singleton class"); + } p = mrb_obj_alloc(mrb, mrb_type(obj), mrb_obj_class(mrb, obj)); dup = mrb_obj_value(p); init_copy(mrb, dup, obj); |
