Buggy code:
final class FieldsReader { private final FieldInfos fieldInfos ; private final IndexInput cloneableFieldsStream ; private final IndexInput fieldsStream ; private final IndexInput indexStream ; private int numTotalDocs ; private int size ; private boolean closed ; private int docStoreOffset ; private ThreadLocal fieldsStreamTL = new ThreadLocal ( ) ; FieldsReader ( Directory d , String segment , FieldInfos fn ) throws IOException { } FieldsReader ( Directory d , String segment , FieldInfos fn , int readBufferSize ) throws IOException { } FieldsReader ( Directory d , String segment , FieldInfos fn , int readBufferSize , int docStoreOffset , int size ) throws IOException { } protected final void ensureOpen ( ) throws AlreadyClosedException { } final void close ( ) throws IOException { } final int size ( ) { } final Document doc ( int n , FieldSelector fieldSelector ) throws IOException , CorruptIndexException { } final IndexInput rawDocs ( int [ ] lengths , int startDocID , int numDocs ) throws IOException { <START_BUG> indexStream . seek ( ( startDocID * 8L ) ) ; <END_BUG> long startOffset = indexStream . readLong ( ) ; long lastOffset = startOffset ; int count = 0 ; while ( count < numDocs ) { final long offset ; final int docID = ( ( ( docStoreOffset ) + startDocID ) + count ) + 1 ; assert docID <= ( numTotalDocs ) ; if ( docID < ( numTotalDocs ) ) offset = indexStream . readLong ( ) ; else offset = fieldsStream . length ( ) ; lengths [ ( count ++ ) ] = ( ( int ) ( offset - lastOffset ) ) ; lastOffset = offset ; } fieldsStream . seek ( startOffset ) ; return fieldsStream ; } private void skipField ( boolean binary , boolean compressed ) throws IOException { } private void skipField ( boolean binary , boolean compressed , int toRead ) throws IOException { } private void addFieldLazy ( Document doc , FieldInfo fi , boolean binary , boolean compressed , boolean tokenize ) throws IOException { } private void addFieldForMerge ( Document doc , FieldInfo fi , boolean binary , boolean compressed , boolean tokenize ) throws IOException { } private void addField ( Document doc , FieldInfo fi , boolean binary , boolean compressed , boolean tokenize ) throws IOException , CorruptIndexException { } private int addFieldSize ( Document doc , FieldInfo fi , boolean binary , boolean compressed ) throws IOException { } private TermVector getTermVectorType ( FieldInfo fi ) { } private Index getIndexType ( FieldInfo fi , boolean tokenize ) { } private class LazyField extends AbstractField implements Fieldable { private int toRead ; private long pointer ; public LazyField ( String name , Field . Store store , int toRead , long pointer ) { } public LazyField ( String name , Field . Store store , Field . Index index , Field . TermVector termVector , int toRead , long pointer ) { } private IndexInput getFieldStream ( ) { } public byte [ ] binaryValue ( ) { } public Reader readerValue ( ) { } public TokenStream tokenStreamValue ( ) { } public String stringValue ( ) { } public long getPointer ( ) { } public void setPointer ( long pointer ) { } public int getToRead ( ) { } public void setToRead ( int toRead ) { } } private final byte [ ] uncompress ( final byte [ ] input ) throws IOException , CorruptIndexException { } static final class FieldForMerge extends AbstractField { public String stringValue ( ) { } public Reader readerValue ( ) { } public byte [ ] binaryValue ( ) { } public TokenStream tokenStreamValue ( ) { } public FieldForMerge ( Object value , FieldInfo fi , boolean binary , boolean compressed , boolean tokenize ) { } } }

Fix:
indexStream . seek ( ( ( ( docStoreOffset ) + startDocID ) * 8L ) ) ;