mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
4961 fix casting bug and add min size for registry files
This commit is contained in:
parent
1fcc0e7a78
commit
a8990e0870
@ -52,6 +52,13 @@ interface FileTypeViewer {
|
||||
* fine. Otherwise, it is ambiguous.
|
||||
*/
|
||||
void resetComponent();
|
||||
|
||||
|
||||
/**
|
||||
* Identify whether the viewer is supported for the given file
|
||||
*
|
||||
* @param file to check support for of the appropriate MIME type
|
||||
*
|
||||
* @return true if supported false otherwise
|
||||
*/
|
||||
boolean isSupported(AbstractFile file);
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ class WindowsRegistryViewer extends JPanel implements FileTypeViewer {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger logger = Logger.getLogger(WindowsRegistryViewer.class.getName());
|
||||
private static final String[] SUPPORTED_MIMETYPES = new String[]{"custom/windows-nt-registry"};
|
||||
private static final int MIN_REGISTRY_FILE_SIZE = 1025; //size in bytes
|
||||
private RejView regview;
|
||||
private AbstractFile lastFile;
|
||||
|
||||
@ -58,7 +59,7 @@ class WindowsRegistryViewer extends JPanel implements FileTypeViewer {
|
||||
|
||||
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
|
||||
if (content.getSize() == 0) {
|
||||
if (content.getSize() < MIN_REGISTRY_FILE_SIZE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -98,7 +99,7 @@ class WindowsRegistryViewer extends JPanel implements FileTypeViewer {
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
if (file.getSize() == 0) {
|
||||
if (file.getSize() < MIN_REGISTRY_FILE_SIZE) {
|
||||
return false;
|
||||
}
|
||||
byte[] header = new byte[0x4000];
|
||||
@ -134,8 +135,6 @@ class WindowsRegistryViewer extends JPanel implements FileTypeViewer {
|
||||
return; //prevent from loading twice if setNode() called mult. times
|
||||
}
|
||||
lastFile = file;
|
||||
if (isSupported(file)) {
|
||||
this.setDataView(file);
|
||||
}
|
||||
this.setDataView(file);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ final class RejTreeView extends JScrollPane implements TreeExpansionListener, Tr
|
||||
TreePath path = event.getPath();
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
|
||||
|
||||
if (node.getChildCount() == 0) {
|
||||
if (node instanceof RejTreeNode && node.getChildCount() == 0) {
|
||||
RejTreeNode n = (RejTreeNode) node.getUserObject();
|
||||
for (RejTreeNode rejTreeNode : n.getChildren()) {
|
||||
node.add(getTreeNode(rejTreeNode));
|
||||
|
Loading…
x
Reference in New Issue
Block a user