A tar.gz file may have an invalid tar file in the gzip. The
getNextEntry would return null in such a case. This performs
that null check in order to validate the tar and avoid a user-
facing NPE.
Change-Id: I28ae7c787d77a0f1c9136264cfc678d7e52cda1a
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/87247
Reviewed-by: Hudson CI
Reviewed-by: Marc-André Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-André Laperle <marc-andre.laperle@ericsson.com>
entryEnumerationStream = new TarArchiveInputStream(fInputStream);
try {
curEntry = (TarArchiveEntry) entryEnumerationStream.getNextEntry();
- if (!curEntry.isCheckSumOK()) {
+ if (curEntry == null || !curEntry.isCheckSumOK()) {
throw new IOException("Error detected parsing initial entry header"); //$NON-NLS-1$
}
} catch (IOException e) {