Skip to content
Snippets Groups Projects
Unverified Commit f3e42136 authored by Jayaram Sreevalsan's avatar Jayaram Sreevalsan Committed by GitHub
Browse files

Merge pull request #2869 from gdicristofaro/CT-7342_addImageNoPath

CT-7342 read no bytes when image path is missing
parents e2a6c99d d892c762
Branches
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
package org.sleuthkit.datamodel; package org.sleuthkit.datamodel;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
/** /**
* Represents a file system object stored in tsk_fs_info table FileSystem has a * Represents a file system object stored in tsk_fs_info table FileSystem has a
...@@ -69,6 +70,10 @@ public void close() { ...@@ -69,6 +70,10 @@ public void close() {
@Override @Override
public int read(byte[] buf, long offset, long len) throws TskCoreException { public int read(byte[] buf, long offset, long len) throws TskCoreException {
Content dataSource = getDataSource();
if (dataSource instanceof Image && ArrayUtils.isEmpty(((Image) dataSource).getPaths())) {
return 0;
}
return SleuthkitJNI.readFs(getFileSystemHandle(), buf, offset, len); return SleuthkitJNI.readFs(getFileSystemHandle(), buf, offset, len);
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.apache.commons.lang3.ArrayUtils;
import org.sleuthkit.datamodel.TskData.FileKnown; import org.sleuthkit.datamodel.TskData.FileKnown;
import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM; import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
import org.sleuthkit.datamodel.TskData.TSK_FS_ATTR_TYPE_ENUM; import org.sleuthkit.datamodel.TskData.TSK_FS_ATTR_TYPE_ENUM;
...@@ -183,6 +184,12 @@ protected synchronized int readInt(byte[] buf, long offset, long len) throws Tsk ...@@ -183,6 +184,12 @@ protected synchronized int readInt(byte[] buf, long offset, long len) throws Tsk
//special case for 0-size file //special case for 0-size file
return 0; return 0;
} }
Content dataSource = getDataSource();
if (dataSource instanceof Image && ArrayUtils.isEmpty(((Image) dataSource).getPaths())) {
return 0;
}
loadFileHandle(); loadFileHandle();
return SleuthkitJNI.readFile(fileHandle, buf, offset, len); return SleuthkitJNI.readFile(fileHandle, buf, offset, len);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment