www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Bug in SliceStream.readBlock and writeBlock

The lines

in SliceStream.readBlock are wrong, it should read "high - low - pos" in both
lines. Since "high" is the end of the stream, and "low + pos" is the current
position, then "high - (low + pos)" = "high - low - pos" is the number of bytes
left. The same goes for SliceStream.writeBlock.

As it stands, readBlock does not return 0 at the end of the slice, and
writeBlock is allowed to write outside the slice, possibly overwriting other
parts of the file.

Jun 19 2005