summaryrefslogtreecommitdiff
path: root/ext/digest/digest.c
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
commit4c9a9a620af6a026773f1339dedec12d66af7867 (patch)
tree8ba6a1af279cb1f738c716a184026384bcb8f5e2 /ext/digest/digest.c
parentd878585e5f3bc9d23df7704a817a7a10f7427e7f (diff)
* ext/digest/digest.c (rb_digest_base_s_digest,
rb_digest_base_s_hexdigest): ensure that a string is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest/digest.c')
-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 f737d25..5355776 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);