mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
lib/suitar: reset bIndex after flushing a full block
Write left w.bIndex at 512 once a full block had been written out, so the next loop iteration took the "partial block" branch, copied zero bytes and went round again forever, writing the same 512 bytes over and over. Calling Write with sizes that aren't multiples of 512 is enough to hit this. It also duplicated the last data block when a Write call happened to end exactly on a block boundary, because flush then saw a non-zero bIndex and wrote the block out a second time.
This commit is contained in:
1 parent
0f214ba59c
commit
05a8209fa7
1 file changed
+1
@@ -457,6 +457,7 @@ func (w *Writer) Write(b []byte) (int, error) {
|
||||
w.err = err
|
||||
break
|
||||
}
|
||||
w.bIndex = 0
|
||||
}
|
||||
|
||||
if tooMuch && (w.err == nil) {
|
||||
|
||||
Reference in new issue
Block a user