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

Wallet FFI panics if invalid non-null pointers are passed in. #6645

Open
hansieodendaal opened this issue Oct 22, 2024 · 0 comments
Open

Wallet FFI panics if invalid non-null pointers are passed in. #6645

hansieodendaal opened this issue Oct 22, 2024 · 0 comments

Comments

@hansieodendaal
Copy link
Contributor

hansieodendaal commented Oct 22, 2024

Describe the bug
Wallet FFI panics if invalid non-null pointers are passed in.

As an example of this when calling

pub unsafe extern "C" fn scrape_wallet(
    wallet: *mut TariWallet,
    destination: *mut TariWalletAddress,
    fee_per_gram: c_ulonglong,
    error_out: *mut c_int,
)

with a valid TariWallet pointer for destination instead of a valid TariWalletAddress, pointer, the FFI code panics with

thread 'tokio-runtime-worker' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/curve25519-dalek-4.1.3/src/backend/serial/u64/field.rs:138:21:
attempt to multiply with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If the function is called with a valid TariWalletAddress pointer for wallet instead of a valid TariWallet, pointer, the FFI code panics with

Thread 1: EXC_BAD_ACCESS (code=1, address=0x32778af620643)

To Reproduce
Steps to reproduce the behavior:
As described above.

Expected behavior
Checks should be built into all FFI interface functions to determine the validity of the object pointers.

Screenshots
n/a

Desktop (please complete the following information):

  • MAC

Smartphone (please complete the following information):

  • iPhone

Additional context
This is a development issue, but could easily be targeted by evil geniuses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant