Merge pull request #4380 from wschaeferB/4535-FixSevenzipDeDupe

4535 change path used for detection of existing files to not include data source
This commit is contained in:
Richard Cordovano 2018-12-14 15:33:26 -05:00 committed by GitHub
commit c63d0676b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,7 +185,7 @@ class SevenZipExtractor {
//As a result, many corrupted files have wonky compression ratios and could flood the UI //As a result, many corrupted files have wonky compression ratios and could flood the UI
//with false zip bomb notifications. The decision was made to skip compression ratio checks //with false zip bomb notifications. The decision was made to skip compression ratio checks
//for unallocated zip files. Instead, we let the depth be an indicator of a zip bomb. //for unallocated zip files. Instead, we let the depth be an indicator of a zip bomb.
if(archiveFile.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.UNALLOC)) { if (archiveFile.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.UNALLOC)) {
return false; return false;
} }
@ -370,12 +370,8 @@ class SevenZipExtractor {
* @return the archiveFilePath to be used by the unpack method * @return the archiveFilePath to be used by the unpack method
*/ */
private String getArchiveFilePath(AbstractFile archiveFile) { private String getArchiveFilePath(AbstractFile archiveFile) {
try {
return archiveFile.getUniquePath();
} catch (TskCoreException ex) {
return archiveFile.getParentPath() + archiveFile.getName(); return archiveFile.getParentPath() + archiveFile.getName();
} }
}
/** /**
* Create the local directories if they do not exist for the archive * Create the local directories if they do not exist for the archive
@ -810,11 +806,11 @@ class SevenZipExtractor {
} }
/** /**
* UnpackStream used by the SevenZipBindings to do archive extraction. A memory * UnpackStream used by the SevenZipBindings to do archive extraction. A
* leak exists in the SevenZip library that will not let go of the streams until * memory leak exists in the SevenZip library that will not let go of the
* the entire archive extraction is complete. Instead of creating a new UnpackStream * streams until the entire archive extraction is complete. Instead of
* for every file in the archive, instead we just rebase our EncodedFileOutputStream pointer * creating a new UnpackStream for every file in the archive, instead we
* for every new file. * just rebase our EncodedFileOutputStream pointer for every new file.
*/ */
private final static class UnpackStream implements ISequentialOutStream { private final static class UnpackStream implements ISequentialOutStream {
@ -854,7 +850,7 @@ class SevenZipExtractor {
} }
public void close() throws IOException { public void close() throws IOException {
try(EncodedFileOutputStream out = output) { try (EncodedFileOutputStream out = output) {
out.flush(); out.flush();
} }
} }