I was playing with on-the-fly checksum verification and this made me stumble upon an issue with BufferedChecksumIndexInput.
I have some code that skips over a DataInput by reading bytes into /dev/null, eg.
It is fine to read into this static buffer, even from multiple threads, since the content that is read doesn't matter here. However, it breaks with BufferedChecksumIndexInput because of the way that it updates the checksum:
If you are unlucky enough so that a concurrent call to skipBytes started modifying the content of b before the call to digest.update(b, offset, len) finished, then your checksum will be wrong.
I think we should make BufferedChecksumIndexInput read into a private buffer first instead of relying on the user-provided buffer.