From 2677f72e2e8088abd77db2bb8895a1bb94335a3e Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 8 Sep 2007 01:08:23 +0000 Subject: * struct.c (rb_struct_s_members): check if __members__ is an array to prevent segmentation fault. [ruby-dev:31759] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- struct.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'struct.c') diff --git a/struct.c b/struct.c index f87b33b050..671788fc10 100644 --- a/struct.c +++ b/struct.c @@ -39,6 +39,9 @@ rb_struct_s_members(VALUE klass) if (NIL_P(members)) { rb_raise(rb_eTypeError, "uninitialized struct"); } + if (TYPE(members) != T_ARRAY) { + rb_raise(rb_eTypeError, "corrupted struct"); + } return members; } -- cgit v1.2.3