Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: Fixing PyGhidra version check when things like "-BETA" are present

Ryan Kurtz6d36df6eca64
diff --git a/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/launcher.py b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/launcher.py
index 385b63bfbd..31214c4b11 100644
--- a/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/launcher.py
+++ b/Ghidra/Features/PyGhidra/src/main/py/src/pyghidra/launcher.py
@@ -396,7 +396,8 @@ class PyGhidraLauncher:
Checks if the currently installed Ghidra version is supported.
The launcher will report the problem and terminate if it is not supported.
"""
- if Version(self.app_info.version) < Version(MINIMUM_GHIDRA_VERSION):
+ base_version = self.app_info.version.split('-')[0] # remove things like "-BETA"
+ if Version(base_version) < Version(MINIMUM_GHIDRA_VERSION):
msg = f"Ghidra version {self.app_info.version} is not supported" + os.linesep + \
f"The minimum required version is {MINIMUM_GHIDRA_VERSION}"
self._report_fatal_error("Unsupported Version", msg, ValueError(msg))
@@ -744,7 +745,7 @@ def _run_mac_app():
return res
CFRunLoopTimerCallback = CFUNCTYPE(None, c_void_p, c_void_p)
- kCFRunLoopDefaultMode = c_void_p.in_dll(CoreFoundation, "kCFRunLoopDefaultMode")
+ kCFRunLoopDefaultMode = c_void_p.in_dll(CoreFoundation, "kCFRunLoopDefaultMode") # @UndefinedVariable
kCFRunLoopRunFinished = c_int32(1)
NULL = c_void_p(0)
INF_TIME = c_double(1.0e20)