Skip to content

CompareExecutablesScript Could not locate vector because ID is 0 #8948

@jordanjohnson56

Description

@jordanjohnson56

Describe the bug
If a function fails to decompile when generating signatures for a BSim database (we are using Elasticsearch), the function gets added to the database, but no signature is generated and the function's signature ID is set to 0. This causes the CompareExecutablesScript to fail when it tries to get the signatures for that executable. Specifically, it throws this error:

Could not locate vector by id
LSHException: Could not locate vector by id
	at ghidra.features.bsim.query.client.ExecutableComparison.buildSeedVector(ExecutableComparison.java:270)
	at ghidra.features.bsim.query.client.ExecutableComparison.fillinSelfScores(ExecutableComparison.java:501)
	at CompareExecutablesFixScript.run(CompareExecutablesFixScript.java:103)
	at ghidra.app.script.GhidraScript.executeNormal(GhidraScript.java:460)
	at ghidra.app.script.GhidraScript.doExecute(GhidraScript.java:314)
	at ghidra.app.script.GhidraScript.execute(GhidraScript.java:290)
	at ghidra.app.plugin.core.script.RunScriptTask.run(RunScriptTask.java:46)
	at ghidra.util.task.Task.monitoredRun(Task.java:134)
	at ghidra.util.task.TaskRunner.lambda$startTaskThread$0(TaskRunner.java:106)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

---------------------------------------------------
Build Date: 2026-Jan-29 1619 EST
Ghidra Version: 12.0.2
Java Home: /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
JVM Version: Oracle Corporation 21.0.8
OS: Mac OS X 26.2 aarch64

This happens because the query in buildSeedVector() fails to return a record for a signature with ID 0.

To Reproduce
Steps to reproduce the behavior:

  1. Generate BSim signatures for an executable with at least one function that fails to decompile and commit them to a BSim database (this may be specific to Elasticsearch, we're not sure).
  2. Run CompareExecutablesScript.java from the Script Manager, pointing it at the BSim database with the signatures generated in step 1.

Expected behavior
The script should still be able to run a comparison against executables with 1 or more functions missing signatures. Either (1) a function record should not be created in the BSim database for a function without a signature or (2) the ExecutableComparison functions should be able to skip these functions missing signatures.

Screenshots
N/A

Attachments
N/A

Environment (please complete the following information):

  • OS: Mac OS X 26.2 aarch64
  • Java Version: Oracle Corporation 21.0.8
  • Ghidra Version: 12.0.2
  • Ghidra Origin: official GitHub distro

Additional context
The executable that triggers this issue for us is a compiled version of GNU inetutils telnet v2.6. The vasnprintf function fails to decompile, resulting in the error mentioned above.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions