aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2016-09-10 21:44:13 +0300
committerLasse Collin <lasse.collin@tukaani.org>2016-09-10 21:44:13 +0300
commit9dcae4d105d88e5b6db868a5af9ae99ba6aa3930 (patch)
tree9db177479bbbc7c12b04f02ec18edcb48f01ce64
parentfda4a27189372bb3cbc1190b34c7710ec739c853 (diff)
downloadxz-java-9dcae4d105d88e5b6db868a5af9ae99ba6aa3930.tar.gz
Improve an error message about corrupt XZ Index.
-rw-r--r--src/org/tukaani/xz/index/IndexHash.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/org/tukaani/xz/index/IndexHash.java b/src/org/tukaani/xz/index/IndexHash.java
index ab168c6..61725a5 100644
--- a/src/org/tukaani/xz/index/IndexHash.java
+++ b/src/org/tukaani/xz/index/IndexHash.java
@@ -50,9 +50,13 @@ public class IndexHash extends IndexBase {
CheckedInputStream inChecked = new CheckedInputStream(in, crc32);
// Get and validate the Number of Records field.
+ // If Block Header Size was corrupt and became Index Indicator,
+ // this error would actually be about corrupt Block Header.
+ // This is why the error message mentions both possibilities.
long storedRecordCount = DecoderUtil.decodeVLI(inChecked);
if (storedRecordCount != recordCount)
- throw new CorruptedInputException("XZ Index is corrupt");
+ throw new CorruptedInputException(
+ "XZ Block Header or the start of XZ Index is corrupt");
// Decode and hash the Index field and compare it to
// the hash value calculated from the decoded Blocks.