mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 06:05:12 +08:00
GP-4050: Fixed an uncaught InvalidPathException that could occur when loading libraries during import
This commit is contained in:
+13
-9
@@ -17,8 +17,7 @@ package ghidra.app.util.opinion;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.*;
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -1059,13 +1058,18 @@ public abstract class AbstractLibrarySupportLoader extends AbstractProgramLoader
|
|||||||
List<FileSystemSearchPath> result = new ArrayList<>();
|
List<FileSystemSearchPath> result = new ArrayList<>();
|
||||||
FileSystemService fsService = FileSystemService.getInstance();
|
FileSystemService fsService = FileSystemService.getInstance();
|
||||||
if (isLoadSystemLibraries(options) || shouldSearchAllPaths(options)) {
|
if (isLoadSystemLibraries(options) || shouldSearchAllPaths(options)) {
|
||||||
List<Path> searchPaths = LibrarySearchPathManager.getLibraryPathsList()
|
List<Path> searchPaths = new ArrayList<>();
|
||||||
.stream()
|
for (String str : LibrarySearchPathManager.getLibraryPathsList()) {
|
||||||
.map(s -> Path.of(s).normalize())
|
try {
|
||||||
.filter(Path::isAbsolute)
|
Path path = Path.of(str).normalize();
|
||||||
.filter(Files::exists)
|
if (path.isAbsolute() && Files.exists(path)) {
|
||||||
.toList();
|
searchPaths.add(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (InvalidPathException e) {
|
||||||
|
log.appendMsg("Skipping invalid system library search path: \"" + str + "\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
for (Path searchPath : searchPaths) {
|
for (Path searchPath : searchPaths) {
|
||||||
try {
|
try {
|
||||||
FSRL searchFSRL = fsService.getLocalFSRL(searchPath.toFile());
|
FSRL searchFSRL = fsService.getLocalFSRL(searchPath.toFile());
|
||||||
|
|||||||
Reference in New Issue
Block a user