From: Chris Hanson Date: Sat, 29 Jun 2019 21:21:52 +0000 (-0700) Subject: Fix calls to read-bytevector! that weren't aware of EOF values. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3af6d374f492a4161bedd984acb34b8967478724;p=mit-scheme.git Fix calls to read-bytevector! that weren't aware of EOF values. --- diff --git a/src/edwin/sendmail.scm b/src/edwin/sendmail.scm index 560acafb4..c658af9a9 100644 --- a/src/edwin/sendmail.scm +++ b/src/edwin/sendmail.scm @@ -1464,7 +1464,7 @@ the user from the mailer." (let ((buffer (make-bytevector 4096))) (let loop () (let ((n-read (read-bytevector! buffer input-port))) - (if (> n-read 0) + (if (exact-positive-integer? n-read) (begin (encode-base64:update context buffer 0 n-read) (loop)))))))) diff --git a/src/imail/imail-util.scm b/src/imail/imail-util.scm index d6cef5f42..432407120 100644 --- a/src/imail/imail-util.scm +++ b/src/imail/imail-util.scm @@ -431,7 +431,7 @@ USA. (nread (read-bytevector! buffer port))) ;; Check to make sure that the length didn't change under us ;; while we were reading. If it did, this is no good. - (and (= nread length) + (and (eqv? nread length) (object-new-type type-code:legacy-string buffer)))))) (define (string-port/position port) diff --git a/src/runtime/http-io.scm b/src/runtime/http-io.scm index 3b79c7c5a..c9ca27a8d 100644 --- a/src/runtime/http-io.scm +++ b/src/runtime/http-io.scm @@ -300,7 +300,7 @@ USA. (let loop ((n n)) (if (> n 0) (let ((m (read-bytevector! buffer port 0 (min n len)))) - (if (= m 0) + (if (not (exact-positive-integer? m)) (error "Premature EOF in HTTP message body.")) (do ((i 0 (+ i 1))) ((not (< i m))) @@ -329,7 +329,7 @@ USA. (let ((buffer (make-bytevector #x1000))) (let loop () (let ((n (read-bytevector! buffer port))) - (if (> n 0) + (if (exact-positive-integer? n) (begin (do ((i 0 (+ i 1))) ((not (< i n)))