From: Arthur A. Gleckler Date: Fri, 25 Dec 2009 02:22:33 +0000 (-0800) Subject: Fixed MD5 operations, e.g. `md5-string', so that they would accept the X-Git-Tag: 20100708-Gtk~180 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6f63a8bbac30201bea0c0bb9dfbce3464798dcd2;p=mit-scheme.git 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. --- 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)