summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-01-27 13:56:14 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-01-27 13:56:14 -0800
commit5bb09860276ee5a209abe526c922b838c01af549 (patch)
tree73d0bdf503b9a5aec74dcc169521d6aefb9becb5 /hash.c
parent75df8bf9079c5edf23f6b6d3c4b1c5902ddf9653 (diff)
downloadtxr-5bb09860276ee5a209abe526c922b838c01af549.tar.gz
txr-5bb09860276ee5a209abe526c922b838c01af549.tar.bz2
txr-5bb09860276ee5a209abe526c922b838c01af549.zip
* hash.c (hash_begin): Missing type check added, otherwise
passing in an object that is not a hash results in corruption or crashing behavior. * lib.c (class_check): Improved to a one-step check with a clear message.
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index e03664cd..e8f5bb1b 100644
--- a/hash.c
+++ b/hash.c
@@ -389,7 +389,10 @@ static struct cobj_ops hash_iter_ops = {
val hash_begin(val hash)
{
val hi_obj;
- struct hash_iter *hi = (struct hash_iter *) chk_malloc(sizeof *hi);
+ struct hash_iter *hi;
+ class_check (hash, hash_s);
+
+ hi = (struct hash_iter *) chk_malloc(sizeof *hi);
hi->hash = nil;
hi->chain = -1;
hi->cons = nil;