Make IndexDataReader.readIndex fail fast on "garbage" input
-----------------------------------------------------------
Key: MINDEXER-20
URL: http://jira.codehaus.org/browse/MINDEXER-20
Project: Maven Indexer
Issue Type: Improvement
Affects Versions: 4.0.0, 3.1.0
Reporter: Tamás Cservenák
Priority: Minor
Make IndexDataReader.readIndex fail fast on "garbage" input.
Copied from original issue MINDEXER-13:
Jesse Glick:
Something else I just noticed: IndexDataReader.readIndex reads and discards the
first byte of the (uncompressed) stream, without checking that it is in fact
IndexDataWriter.VERSION. Fixing this to throw an IOException for anything else
would be a good idea in combination with my current patch, which just creates a
DataInputStream from the raw input if it is not in GZIP format but cannot
easily check that the input is anything in particular: at least the reader upon
being given random garbage would at least fail promptly in the common case that
the first byte is not 0x01. (Would have been better for the index format to use
a real magic number, but too late for that.)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira