Skip to content

__attr attributes on pointer types are lost on save/load #8687

Open

Description

@comex

Version and Platform (required):

  • Binary Ninja Version: 6.1.10984-dev
  • Edition: Commercial
  • OS: macOS
  • OS Version: 27.0.1 (26A434)
  • CPU Architecture: arm64

Bug Description:
In various cases when saving and loading, __attr attributes are lost on pointer and reference types.

Steps To Reproduce:
Run the following reproducer. (This uses a TypeArchive for simplicity, but the same behavior occurs when when defining a type in a database and saving and loading.)

from binaryninja import Platform, TypeParser, TypeArchive
platform = Platform['linux-x86_64']
(qnt, ty), errors = TypeParser.default.parse_type_string('int * __attr("key", "val")', platform)
assert len(errors) == 0
archive = TypeArchive.create('test.bnta', platform)
archive.add_type('test', ty)
print('before archive:', ty)
print('after archive:', archive.get_type_by_name('test'))

Output:

before archive: int32_t* __attr("key", "val")
after archive: int32_t*

Expected Behavior:
The __attr should still be there after archiving.

Additional Information:

  • The bug doesn't occur if you replace int * with, say, int (or apparently any type other than a pointer or reference).

  • This bug was discovered by AI but I vouch for the report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions