Thanks for debugging this in more detail.
I'll take a look later unless you come up with a final patch
in the meantime.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
Rich,
Here's the patch for bitstring.ml:
*** bitstring.ml.orig 2011-10-22 11:50:23.058536172 -0700
--- bitstring.ml 2011-10-22 11:56:53.483188450 -0700
***************
*** 853,859 ****
*)
let slenbytes = slen lsr 3 in
if slenbytes > 0 then Buffer.add_substring buf str 0 slenbytes;
! let last = Char.code str.[slenbytes] in (* last char *)
let mask = 0xff lsl (8 - (slen land 7)) in
t.last <- last land mask
);
--- 853,860 ----
*)
let slenbytes = slen lsr 3 in
if slenbytes > 0 then Buffer.add_substring buf str 0 slenbytes;
! let lastidx = min slenbytes ((String.length str) -1) in
! let last = Char.code str.[lastidx] in (* last char *)
let mask = 0xff lsl (8 - (slen land 7)) in
t.last <- last land mask
);
***************
*** 992,998 ****
if blen = 0 then (off, len)
else (
let b = extract_bit data off len 1
! and off = off + 1 and len = len + 1 in
Buffer.add_bit buf b;
loop off len (blen-1)
)
--- 993,999 ----
if blen = 0 then (off, len)
else (
let b = extract_bit data off len 1
! and off = off + 1 and len = len - 1 in
https://code.google.com/p/bitstring/source/detail?r=190
Rich.
--
Richard Jones
Red Hat