Vector35 / Vector35/binaryninja-api

`TypeMapping.get()` method fails to retrieve system types when the type name contains `::`

Open
#6,911 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Effort: Medium Impact: Medium
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Version and Platform (required):

  • Binary Ninja Version: 5.1.7512-test
  • Edition: Ultimate
  • OS: MacOS
  • OS Version:15.4.1
  • CPU Architecture: M4 Max

Bug Description:
TypeMapping.get() method fails to retrieve system types when the type name contains :: (double colons), while direct dictionary access works correctly. User-defined types with :: in their names can be retrieved normally with get().

Steps To Reproduce:

  1. Open any binary with C++ symbols that creates types with namespace qualifiers
  2. Access the Python console
  3. Verify type exists: type bv.types to search for example std::string exists
  4. Try to get the type: bv.types.get('std::string') returns None
  5. With non-namespaced type works correctly

Expected Behavior:
bv.types.get('std::string') should return the same result as bv.types['std::string'] for system types containing ::.

Screenshots/Video Recording:

>>> bv.types
<TypeMapping 132 symbols: {... , 'std::string': <type: immutable:StructureTypeClass 'class std::string'>, ...>
>>> bv.types.get("std::string")
>>> bv.types['std::string']
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/binaryview.py", line 2062, in __getitem__
    raise KeyError(key)
KeyError: 'std::string'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with binaryninja/binaryview.py around line 2062 and the TypeMapping.get entry point. Reproduce the Python console example using bv.types.get('std::string') and bv.types['std::string']; done when namespaced system types return the same result through both access paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
reverse-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.