bytevector-copy! precondition error

Bug #173170 reported by rd on 2007-12-01
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Abdulaziz Ghuloum

Bug Description

i think that the right range check of bytevector-copy! is
off by one.

test case:

(let ((b (make-bytevector 6 0))
      (c (make-bytevector 3 1)))
  (bytevector-copy! b 0 c 1 2)
  (list b c))

expected result:

(#vu8(0 0 0 0 0 0) #vu8(1 0 0))

see patch below,

=== modified file 'scheme/'
--- scheme/ 2007-11-12 04:29:54 +0000
+++ scheme/ 2007-12-01 00:44:57 +0000
@@ -560,10 +560,10 @@
         [(not (bytevector? dst))
          (error 'bytevector-copy! "not a bytevector" dst)]
         [(let ([n ($fx+ src-start k)])
- (or ($fx< n 0) ($fx>= n ($bytevector-length src))))
+ (or ($fx< n 0) ($fx> n ($bytevector-length src))))
          (error 'bytevector-copy! "out of range" src-start k)]
         [(let ([n ($fx+ dst-start k)])
- (or ($fx< n 0) ($fx>= n ($bytevector-length dst))))
+ (or ($fx< n 0) ($fx> n ($bytevector-length dst))))
          (error 'bytevector-copy! "out of range" dst-start k)]
         [(eq? src dst)

Abdulaziz Ghuloum (aghuloum) wrote :

How embarrassing :-) Fixed in revision 1156.

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → Medium
status: New → Fix Committed
Abdulaziz Ghuloum (aghuloum) wrote :

This bug report is about to be closed as the fix comitted
previously will be incorporated in the next 0.0.3 release of
Ikarus Scheme, scheduled for January 31, 2008. A release
candidate tarball is available for download from:
Please do test it if you have the time and report any issues
you might encounter. Thank you very much for your support.
(Sorry for the duplicates; I'm updating every open bug.)

Changed in ikarus:
milestone: none → 0.0.3
Changed in ikarus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers