NationalSecurityAgency/ghidra · error · LSHException

Bad characters in proposed function tag

Error message

Bad characters in proposed function tag

What it means

fdbInstallTag validates query.tag_name with enforceTypeCharacters; failure throws LSHException("Bad characters in proposed function tag").

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java:2958

		if (info.execats == null) {
			info.execats = new ArrayList<>();
		}
		info.execats.add(query.type_name);
		writeExecutableCategories();
		response.info = info;
	}

	/**
	 * Entry point for the Elasticsearch version of InstallTagRequest command:
	 *   Install a new function tag to be managed by this data
	 * @param query is command parameters
	 * @throws LSHException if the command is misconfigured
	 * @throws ElasticException for communication problems with the server
	 */
	private void fdbInstallTag(InstallTagRequest query) throws LSHException, ElasticException {
		final ResponseInfo response = query.installresponse;
		if (!CategoryRecord.enforceTypeCharacters(query.tag_name)) {
			throw new LSHException("Bad characters in proposed function tag");
		}
		// Check for existing tag
		if (info.functionTags != null) {
			if (info.functionTags.contains(query.tag_name)) {
				throw new LSHException("Function tag already exists");
			}
		}
		if (info.functionTags == null) {
			info.functionTags = new ArrayList<>();
		}
		// There are only 32-bits of space in the function record reserved for storing the presence of tags
		if (info.functionTags.size() >= FunctionTagBSimFilterType.MAX_TAG_COUNT) {
			throw new LSHException(
				"Cannot allocate new function tag: " + query.tag_name + " - Column space is full");
		}
		info.functionTags.add(query.tag_name);
		writeFunctionTags();
		response.info = info;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Sanitize tag_name to the allowed character set before issuing the request.
  2. Reject null/empty tag names upstream.

Example fix

// before
req.tag_name = symbol; // 'thunk@plt'
// after
req.tag_name = sanitize(symbol); // 'thunk_plt'
Defensive patterns

Strategy: validation

Validate before calling

if (!CategoryRecord.enforceTypeCharacters(req.tag_name))
    throw new IllegalArgumentException("Invalid tag name: " + req.tag_name);

Type guard

boolean validTag = CategoryRecord.enforceTypeCharacters(name);

Prevention

When it happens

Trigger: An InstallTagRequest whose tag_name is None, empty, or contains characters outside the allowed set.

Common situations: Tag name derived from a Ghidra symbol/label containing '@', '*', '[]', '<>', etc.; empty value from a missing arg.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/afbdab4033dc409e. Report an issue: GitHub.