Ghidra is a software reverse engineering (SRE) framework
GP-1693 protect against NPE with BlockStreamServer
ghidra19bf394f90ae3
diff --git a/Ghidra/Features/GhidraServer/src/main/java/ghidra/server/stream/BlockStreamServer.java b/Ghidra/Features/GhidraServer/src/main/java/ghidra/server/stream/BlockStreamServer.javaindex 1bac423eab..12de874d43 100644--- a/Ghidra/Features/GhidraServer/src/main/java/ghidra/server/stream/BlockStreamServer.java+++ b/Ghidra/Features/GhidraServer/src/main/java/ghidra/server/stream/BlockStreamServer.java@@ -315,11 +315,12 @@ public class BlockStreamServer extends Thread {}else if (!(e instanceof EOFException)) { // silent on closed connectionlog.error("file block stream failed from " + socket.getInetAddress() + ": " +- e.getMessage());+ e.getMessage(), e);}}finally {- if (!success && (registration.blockStream instanceof InputBlockStream)) {+ if (!success && (registration != null) &&+ (registration.blockStream instanceof InputBlockStream)) {// ensure input stream is closed since it can be terminated by client,// let client handle error if anytry {@@ -337,7 +338,9 @@ public class BlockStreamServer extends Thread {// ignore}}- registration.state = HandlerConnectionState.CLOSED;+ if (registration != null) {+ registration.state = HandlerConnectionState.CLOSED;+ }}}