From 14066b3ec9b1839af8965371e5eee8668cafc2c0 Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Tue, 15 May 2007 23:24:07 -0400 Subject: [PATCH] * added a check for non-negative integer for bytevector-uint-set!. --- src/ikarus.bytevectors.ss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ikarus.bytevectors.ss b/src/ikarus.bytevectors.ss index 048d08f..025c80b 100644 --- a/src/ikarus.bytevectors.ss +++ b/src/ikarus.bytevectors.ss @@ -356,7 +356,7 @@ ($bytevector-set! x k r))])) (define (big-uint-set! x k1 n k2) (cond - [($fx= k1 k2) + [($fx= k1 k2) (unless (zero? n) (error 'bytevector-uint-set! "value out of range"))] [else @@ -370,7 +370,8 @@ (unless (bytevector? x) (error who "~s is not a bytevector" x)) (unless (and (fixnum? k) ($fx>= k 0)) (error who "invalid index ~s" k)) (unless (and (fixnum? size) ($fx>= size 1)) (error who "invalid size ~s" size)) - (unless (or (fixnum? n) (bignum? n)) (error who "invalid value ~s" n)) + (unless (or (and (fixnum? n) ($fx>= n 0)) (and (bignum? n) (>= n 0))) + (error who "invalid value ~s" n)) (case endianness [(little) (little-uint-set! x k n size)] [(big) (big-uint-set! x k n ($fx+ k size))]