summaryrefslogtreecommitdiffstats
path: root/ext/digest
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-06 05:02:29 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-06 05:02:29 +0000
commit0d0aa05455506b1c6a8e4d1b85693766003559ac (patch)
tree8ba6a1af279cb1f738c716a184026384bcb8f5e2 /ext/digest
parent5a417932373818b1123077e6e8b3d95369c0b654 (diff)
downloadruby-0d0aa05455506b1c6a8e4d1b85693766003559ac.tar.gz
ruby-0d0aa05455506b1c6a8e4d1b85693766003559ac.tar.xz
ruby-0d0aa05455506b1c6a8e4d1b85693766003559ac.zip
* ext/digest/digest.c (rb_digest_base_s_digest,
rb_digest_base_s_hexdigest): ensure that a string is given. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest')
-rw-r--r--ext/digest/digest.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index f737d254a..535577611 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -96,6 +96,12 @@ rb_digest_base_s_digest(class, str)
if (class == cDigest_Base)
rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
+#ifdef StringValue
+ StringValue(str);
+#else
+ Check_Type(str, T_STRING);
+#endif
+
algo = get_digest_base_metadata(class);
pctx = xmalloc(algo->ctx_size);
@@ -129,6 +135,12 @@ rb_digest_base_s_hexdigest(class, str)
if (class == cDigest_Base)
rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
+#ifdef StringValue
+ StringValue(str);
+#else
+ Check_Type(str, T_STRING);
+#endif
+
algo = get_digest_base_metadata(class);
pctx = xmalloc(algo->ctx_size);