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

Implement rust TemporaryFile #5430

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

rbran
Copy link
Contributor

@rbran rbran commented May 17, 2024

I'm slowly implementing functions from the Core API that are missing on the rust API.

@rbran rbran force-pushed the more-functions branch from 09a967c to f63860c Compare May 21, 2024 13:36
@rbran rbran marked this pull request as ready for review May 24, 2024 12:51
@ElykDeer ElykDeer added the Component: Rust API Issue needs changes to the Rust API label May 28, 2024
@emesare emesare requested review from ElykDeer and emesare July 22, 2024 23:03
major: info_raw.major,
minor: info_raw.minor,
build: info_raw.build,
channel: unsafe { string::BnString::from_raw(info_raw.channel) },
Copy link
Member

@emesare emesare Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will crash on local builds of binary ninja due to a bug (unrelated to this PR) for any other reviewers. I don't think this should block as the fix is in the core.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is in latest dev for the crash so no cause for alarm anymore :)

let data = DataBuffer::new(DATA).unwrap();
let tmp_file = TemporaryFile::new_from_contents(&data).unwrap();
let data_read = tmp_file.contents();
assert_eq!(data_read.get_data(), DATA);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot get this to work under headless:

assertion `left == right` failed
  left: []
 right: [116, 101, 115, 116, 32, 49, 50, 51]

@emesare
Copy link
Member

emesare commented Jul 24, 2024

Other than the comments I left LGTM

If temporary files do not work under headless (???) then they will IMO have to be omitted until that is resolved.

@emesare emesare force-pushed the more-functions branch 2 times, most recently from 85a26f2 to 7fef169 Compare July 26, 2024 22:18
@emesare emesare removed the request for review from ElykDeer July 26, 2024 22:23
Comment on lines +102 to +103
pub fn is_shutdown_requested() {
unsafe { binaryninjacore_sys::BNIsShutdownRequested() };

This comment was marked as resolved.

@emesare
Copy link
Member

emesare commented Jul 28, 2024

This PR will stay half-merged until TemporaryFile::contents() is fixed. Everything but TemporaryFile has been merged with 031456e and 3615742

@emesare emesare changed the title Implement functions from CoreAPI Implement rust TemporaryFile Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Rust API Issue needs changes to the Rust API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants