summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-29 12:06:39 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-29 12:06:39 +0000
commit8cb0de91c4b00a0615d1bef672b17154495f0a0f (patch)
treed65c53546e8e54edea245e2f8c9cb74ae2d13e6f /enumerator.c
parentef01a5a6490472e00cad6562074e0eab77aa4f22 (diff)
Add a frozenness check to Enumerator#initialize.
* enumerator.c (enumerator_init): Add a frozenness check to prevent a frozen Enumerator object from being reinitialized with a different enumerable object. This is the least we should do, and more fixes will follow. [Fixes GH-368] Patch by Kenichi Kamiya. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/enumerator.c b/enumerator.c
index 662056d..54cbdc4 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -270,6 +270,7 @@ enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv, rb
{
struct enumerator *ptr;
+ rb_check_frozen(enum_obj);
TypedData_Get_Struct(enum_obj, struct enumerator, &enumerator_data_type, ptr);
if (!ptr) {