[ https://issues.apache.org/jira/browse/LUCENE-3255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057144#comment-13057144 ]
Michael McCandless commented on LUCENE-3255: -------------------------------------------- Ahh, good idea Simon! That should work. Another simple thing we could do is, throw an exc if we did not consume all bytes from the segments file. In this case, the segments file was 20 bytes long, but the double 0 ints only consumes 8 bytes (two 0 ints). > Corrupted segment file not detected and wipes index contents > ------------------------------------------------------------ > > Key: LUCENE-3255 > URL: https://issues.apache.org/jira/browse/LUCENE-3255 > Project: Lucene - Java > Issue Type: Bug > Affects Versions: 2.9.4, 3.2 > Reporter: Mark Harwood > Assignee: Michael McCandless > Fix For: 3.4 > > Attachments: AllZerosSegmentFile, BadSegmentsFileTest.java, > CorruptionCheckerForPreLucene3.java, LUCENE-3255.patch, > LUCENE-3255_testcase.patch > > > Lucene will happily wipe an existing index if presented with a latest > generation segments_n file of all zeros. File format documentation says > segments_N files should start with a format of -9 but SegmentInfos.read > accepts >=0 as valid for backward compatibility reasons. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org