`__attr` attributes on pointer types are lost on save/load

Offen
#8,687 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
cpp, python
Bereich
backend, databases

Rechercherichtung

Start with the Python reproducer in the issue: parse int * __attr("key", "val"), add the type to a TypeArchive, and compare it before and after retrieving it. Trace how pointer and reference type attributes are serialized and restored, then find the relevant tests for type archives. Done means the archived type retains its __attr and the reproducer passes.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
C++
Sterne
1.3k
Forks
304
Ø Merge
2 T. 20 Std.
Gemergte PRs (30 T.)
10

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Vector35/binaryninja-api

Alle Issues in Vector35/binaryninja-api

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.