From 9034e685daab6f18184fce0ce8fd8e4698875508 Mon Sep 17 00:00:00 2001 From: "Samuel H. Kenyon" Date: Mon, 21 Apr 2014 11:36:57 -0400 Subject: [PATCH] Fixed some thread-safety issues in ScalpelCarver. --- .../sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java | 2 +- .../src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java index af8de00f89..d85946a954 100644 --- a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/ScalpelCarverIngestModule.java @@ -115,7 +115,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges @Override public ProcessResult process(AbstractFile abstractFile) { - ScalpelCarver.init(); // RJCTODO: Is this ScalpelCarver class thread-safe? + ScalpelCarver.init(); if (!initialized) { return ProcessResult.OK; diff --git a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java index 70ea7cd029..693681523c 100644 --- a/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java +++ b/ScalpelCarver/src/org/sleuthkit/autopsy/scalpel/jni/ScalpelCarver.java @@ -39,7 +39,7 @@ public class ScalpelCarver { private static final String SCALPEL_JNI_LIB = "libscalpel_jni"; private static final String SCALPEL_OUTPUT_FILE_NAME = "audit.txt"; - private static boolean initialized = false; + private static volatile boolean initialized = false; private static final Logger logger = Logger.getLogger(ScalpelCarver.class.getName()); private static native void carveNat(String carverInputId, ReadContentInputStream input, String configFilePath, String outputFolderPath) throws ScalpelException; @@ -48,7 +48,7 @@ public class ScalpelCarver { } - public static boolean init() { + public static synchronized boolean init() { if (initialized) { return true; }