Merge remote-tracking branch 'origin/GT-2745_caheckman'

This commit is contained in:
ghidravore 2019-04-16 14:50:37 -04:00
commit fddb09f2f3
6 changed files with 24 additions and 19 deletions

View File

@ -1111,7 +1111,9 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
} }
else { else {
buildSortedDataTypeList(); buildSortedDataTypeList();
Iterator<DataType> it = sortedDataTypes.iterator(); // make copy of sortedDataTypes list before iterating as dt.dataTypeReplaced may
// call back into this class and cause a modification to the sortedDataTypes list.
Iterator<DataType> it = new ArrayList<>(sortedDataTypes).iterator();
while (it.hasNext()) { while (it.hasNext()) {
DataType dt = it.next(); DataType dt = it.next();
dt.dataTypeReplaced(existingDt, newDt); dt.dataTypeReplaced(existingDt, newDt);

View File

@ -118,8 +118,8 @@ public class DynamicHash {
reg = SimpleCRC32.hashOneByte(reg, slot); reg = SimpleCRC32.hashOneByte(reg, slot);
reg = SimpleCRC32.hashOneByte(reg, transtable[op.getOpcode()]); reg = SimpleCRC32.hashOneByte(reg, transtable[op.getOpcode()]);
long val = op.getSeqnum().getTarget().getOffset(); long val = op.getSeqnum().getTarget().getOffset();
int sz = op.getSeqnum().getTarget().getPointerSize(); int sz = op.getSeqnum().getTarget().getSize();
for (int i = 0; i < sz; ++i) { for (int i = 0; i < sz; i += 8) {
reg = SimpleCRC32.hashOneByte(reg, (int) val); reg = SimpleCRC32.hashOneByte(reg, (int) val);
val >>= 8; val >>= 8;
} }

View File

@ -56,7 +56,7 @@ public class GhidraLauncher {
addExternalJarPaths(classpathList, layout.getApplicationRootDirs()); addExternalJarPaths(classpathList, layout.getApplicationRootDirs());
} }
else { else {
addPatchPaths(classpathList, layout.getApplicationRootDirs()); addPatchPaths(classpathList, layout.getApplicationInstallationDir());
addModuleJarPaths(classpathList, layout.getModules()); addModuleJarPaths(classpathList, layout.getModules());
} }
classpathList = orderClasspath(classpathList); classpathList = orderClasspath(classpathList);
@ -79,25 +79,16 @@ public class GhidraLauncher {
} }
/** /**
* Add bin patch directories and lib patch jars to the given path list. This should be done * Add patch jars to the given path list. This should be done
* first so they take precedence in the classpath. * first so they take precedence in the classpath.
* *
* @param pathList The list of paths to add to. * @param pathList The list of paths to add to.
* @param appRootDirs The application root directories to search. * @param appRootDirs The application root directories to search.
*/ */
private static void addPatchPaths(List<String> pathList, Collection<ResourceFile> appRootDirs) { private static void addPatchPaths(List<String> pathList, ResourceFile installDir) {
ResourceFile patchDir = new ResourceFile(installDir, "Ghidra/patch");
for (ResourceFile rootDir : appRootDirs) { if (patchDir.exists()) {
pathList.addAll(findJarsInDir(patchDir));
ResourceFile dir = new ResourceFile(rootDir, "bin");
if (dir.exists()) {
pathList.add(dir.getAbsolutePath());
}
ResourceFile debugLibDir = new ResourceFile(rootDir, "lib");
if (debugLibDir.exists()) {
pathList.addAll(findJarsInDir(debugLibDir));
}
} }
} }

View File

@ -0,0 +1,3 @@
Drop jar files in this directory to apply patches to an installation of Ghidra. Any jar files
found in this directory will be placed at the front of the classpath, allowing them to override
any existing classes in any module.

View File

@ -0,0 +1,2 @@
##VERSION: 2.0
README.txt||GHIDRA||||END|

View File

@ -394,7 +394,14 @@ task assembleCommon (type: Copy) {
into "Ghidra" into "Ghidra"
filter (ConcatFilter, prepend: buildDateFile) filter (ConcatFilter, prepend: buildDateFile)
} }
////////////////
// Patch Readme
////////////////
from (ROOT_PROJECT_DIR + "/GhidraBuild/patch") {
into "Ghidra/patch"
}
///////////////// /////////////////
// GLOBALS // GLOBALS
///////////////// /////////////////