diff --git a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/PstParser.java b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/PstParser.java index af3c55bf8f..350ee6df6a 100755 --- a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/PstParser.java +++ b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/PstParser.java @@ -254,10 +254,16 @@ class PstParser { int bufferSize = 8176; byte[] buffer = new byte[bufferSize]; int count = attachmentStream.read(buffer); + + if(count == -1) { + throw new IOException("attachmentStream invalid (read() fails). File "+attach.getLongFilename()+ " skipped"); + } + while (count == bufferSize) { out.write(buffer); count = attachmentStream.read(buffer); } + byte[] endBuffer = new byte[count]; System.arraycopy(buffer, 0, endBuffer, 0, count); out.write(endBuffer);