diff options
| author | Xusheng <xusheng@vector35.com> | 2024-03-20 16:07:28 +0800 |
|---|---|---|
| committer | Xusheng <xusheng@vector35.com> | 2024-03-20 22:44:30 +0800 |
| commit | 0d8f6b73d9ca722d620a8af41145cb3cfdd45920 (patch) | |
| tree | 9c8bdd1b0b02bdd983927ce1298334e5495dae05 /python | |
| parent | 9524254213477521804542721606710671523772 (diff) | |
Scripting provider: avoid running command that can return non-ASCII characters. Fix https://github.com/Vector35/binaryninja-api/issues/5192
Diffstat (limited to 'python')
| -rw-r--r-- | python/scriptingprovider.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py index d7d5b5dc..54785ac9 100644 --- a/python/scriptingprovider.py +++ b/python/scriptingprovider.py @@ -1301,6 +1301,7 @@ class PythonScriptingProvider(ScriptingProvider): log_info(f"Ignored python UI plugin: {repo_path}/{module}") return False + # This function can only be used to execute commands that return ASCII-only output, otherwise the decoding will fail def _run_args(self, args, env: Optional[Dict]=None): si = None if sys.platform == "win32": @@ -1313,7 +1314,7 @@ class PythonScriptingProvider(ScriptingProvider): return (False, str(se)) def _pip_exists(self, python_bin: str, python_env: Optional[Dict]=None) -> bool: - return self._run_args([python_bin, "-m", "pip", "--version"], env=python_env)[0] + return self._run_args([python_bin, "-c", "import pip; pip.__version__"], env=python_env)[0] def _satisfied_dependencies(self, python_bin: str) -> Generator[str, None, None]: if python_bin is None: |
