aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-22 04:52:17 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-22 04:52:17 +0000
commit61d1dce5a226d3bf8393fd10777db09b046f68e6 (patch)
treef59cd89b5b80fb356bb70fe67fdaa4ce44203ed2
parent0c97c8e33584e6203bb09c08f92b63bd2cca8ae7 (diff)
downloadruby-61d1dce5a226d3bf8393fd10777db09b046f68e6.tar.gz
* hash.c (hash_alloc): was using tbl pointer without
initialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--hash.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index babd3bce0a..427759bae3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Sep 22 13:50:49 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (hash_alloc): was using tbl pointer without
+ initialization.
+
Wed Sep 22 13:38:12 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* hash.c (rb_hash_rehash): add iteration check. [ruby-dev:24301]
diff --git a/hash.c b/hash.c
index ba3606ce2f..4375020ce5 100644
--- a/hash.c
+++ b/hash.c
@@ -187,7 +187,7 @@ hash_alloc(klass)
OBJSETUP(hash, klass, T_HASH);
hash->ifnone = Qnil;
- hash->tbl = 0;
+ hash->tbl = st_init_table(&objhash);
return (VALUE)hash;
}
@@ -202,12 +202,10 @@ static void
rb_hash_modify(hash)
VALUE hash;
{
+ if (!RHASH(hash)->tbl) rb_raise(rb_eTypeError, "uninitialized Hash");
if (OBJ_FROZEN(hash)) rb_error_frozen("hash");
if (!OBJ_TAINTED(hash) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
- if (RHASH(hash)->tbl == 0) {
- RHASH(hash)->tbl = st_init_table(&objhash);
- }
}
/*