How does this happen? My guess is there is a loop that processes file contents in 8KB blocks, something like this:
bytesRemaining = fileSize;
while(...) {
...
bytesRemaining -= 8192;
if(bytesRemaining < 0)
break;
...
}
bytesRemaining += 8192;
...
// process remaining bytes
See the bug? :-)