Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in parse_types_from_source with options -x c and --std c99 #6225

Open
ElykDeer opened this issue Dec 3, 2024 · 2 comments
Open

Crash in parse_types_from_source with options -x c and --std c99 #6225

ElykDeer opened this issue Dec 3, 2024 · 2 comments
Labels
Component: Type Parser Issue needs changes to Clang/CoreTypeParser Type: Crash Issue is a crash or deadlock

Comments

@ElykDeer
Copy link
Member

ElykDeer commented Dec 3, 2024

There appears to be a bug in Binary Ninja's type parser when combining -x c and --std c99 options. The segfault occurs specifically when both flags are present, while using either flag alone works (though with expected parsing errors).

  1. Segfault only happens with both -x c and --std c99
  2. Issue reproduces across platforms (arm32 and x86-64)
  3. BN version: 4.3.6468-dev

(credit to @fosdickio for the report)

@ElykDeer ElykDeer added Component: Type Parser Issue needs changes to Clang/CoreTypeParser Type: Crash Issue is a crash or deadlock labels Dec 3, 2024
@CouleeApps
Copy link
Member

Can't reproduce? What steps are you taking to cause this crash and what type / args are you parsing that causes this?

@waskyo
Copy link

waskyo commented Dec 4, 2024

Hi, attached is the source file that is causing the issue. I'm able to parse other files without problems.

Here are my repro steps:

from binaryninja import *
bv = load("/bin/ls") # This is x86-64, but i've also tried arm32 with the same results
with open("/tmp/segfault.c") as f:
     source = f.read()

tp = TypeParser.default
tp.parse_types_from_source(source=source, file_name='segfault.c', platform=bv.platform, options=["-x", "c", "--std", "c99"])
Segmentation fault

segfault.c.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Type Parser Issue needs changes to Clang/CoreTypeParser Type: Crash Issue is a crash or deadlock
Projects
None yet
Development

No branches or pull requests

3 participants