from user list -
http://www.gossamer-threads.com/lists/lucene/java-user/50982
Problem seems to be casting issues in RAMInputStream.
Line 90:
bufferStart = BUFFER_SIZE * currentBufferIndex;
both rhs are ints while lhs is long.
so a very large product would first overflow MAX_INT, become negative, and only then (auto) casted to long, but this is too late.
Line 91:
bufferLength = (int) (length - bufferStart);
both rhs are longs while lhs is int.
so the (int) cast result may turn negative and the logic that follows would be wrong.
All tests pass but non of those actually demonstrates the bug being fixed. I don't currently have a large enough index to test this.
I will wait for a manual test by Murali (who reported this issue), and for at least one patch review.