From 6f63a8bbac30201bea0c0bb9dfbce3464798dcd2 Mon Sep 17 00:00:00 2001 From: "Arthur A. Gleckler" Date: Thu, 24 Dec 2009 18:22:33 -0800 Subject: [PATCH] Fixed MD5 operations, e.g. `md5-string', so that they would accept the empty string as input. Before this fix, they would fail with this error: ;The object 0, passed as the third argument to md5-update, is not in the correct range. --- src/runtime/crypto.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/runtime/crypto.scm b/src/runtime/crypto.scm index 217d113d5..1de7d7f42 100644 --- a/src/runtime/crypto.scm +++ b/src/runtime/crypto.scm @@ -261,7 +261,8 @@ USA. (define (mhash-substring hash-type string start end) (let ((context (mhash-init hash-type))) - (mhash-update context string start end) + (if (fix:> end start) + (mhash-update context string start end)) (mhash-end context))) (define (mhash-sum->number sum) @@ -334,7 +335,8 @@ USA. (define (%md5-substring string start end) (let ((context ((ucode-primitive md5-init 0)))) - ((ucode-primitive md5-update 4) context string start end) + (if (fix:> end start) + ((ucode-primitive md5-update 4) context string start end)) ((ucode-primitive md5-final 1) context))) (define md5-sum->number mhash-sum->number) -- 2.25.1