binaryninja-api: Segfault when using binja py API along side lief.

Version and Platform (required):

  • Binary Ninja Version: 3.4.4271 Stable
  • OS: Ubuntu
  • OS Version: 20.04.5 LTS (Focal Fossa)
  • CPU Architecture: x64

Bug Description: It occurs when the lief module is imported in the main py script (along with binaryninja module).

Steps To Reproduce: LIEF version 0.12.3 Python 3.8.10

import lief # remove to not crash
import binaryninja

file = "/bin/ls"

with binaryninja.open_view(file) as bv:
    print(f"Opening {bv.file.filename} which has {len(list(bv.functions))} functions")

(With lief) $ python3 ./test.py Segmentation fault (core dumped)

(without lief) $ python3 ./test.py Opening /bin/ls which has 495 functions

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

can confirm this segfault occurs. able to reproduce on:

binaryninja: '3.6.4532-dev'
lief: '0.12.3-39115d10'
python 3.8.10
ubuntu 20.04

Encountered it on lief 0.12.1 / binary ninja 3.5.4311

Changing the import order of binaryninja before lief seems to resolve the problem. As well as downgrading to an earlier version of lief (originally had 0.11 on the 2nd VM i tested)