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

[Bug] Null pointer dereference panic in single-instance-plugin #2405

Closed
lars-berger opened this issue Feb 8, 2025 · 3 comments · Fixed by #2452
Closed

[Bug] Null pointer dereference panic in single-instance-plugin #2405

lars-berger opened this issue Feb 8, 2025 · 3 comments · Fixed by #2452
Labels
bug Something isn't working platform: windows Windows specific issues plugin: single-instance

Comments

@lars-berger
Copy link

Note that this only occurs on the latest Rust nightly nightly-x86_64-pc-windows-msvc (1.86.0). If I rollback to nightly-2024-10-01-x86_64-pc-windows-msvc, then it no longer occurs.

packages/desktop dev: thread 'main' panicked at C:\Users\larsb\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\tauri-plugin-single-instance-2.2.1\src\platform_impl\windows.rs:121:34:
packages/desktop dev: null pointer dereference occured

Reproduction:

  1. Clone https://github.com/glzr-io/zebar
  2. git checkout 3058a0dd0694fb168b9ee84027bd260ce14fe60a
  3. pnpm i && pnpm dev

Occurs on latest (v2.2.1) of single-instance-plugin

@FabianLars FabianLars added bug Something isn't working plugin: single-instance platform: windows Windows specific issues labels Feb 8, 2025
@ferreira-tb
Copy link
Contributor

I can consistently reproduce this up to nightly-2025-02-17-x86_64-pc-windows-msvc (rustc 1.87).
Last working nightly version was nightly-2025-01-31-x86_64-pc-windows-msvc (rustc 1.86).

May be related to: rust-lang/rust#134424

@wlwatkins
Copy link

Yep after switching to nightly I get this issue

@Islatri
Copy link

Islatri commented Feb 23, 2025

I also got same issue after upgrading to rustc 1.87.0-nightly (794c12416 2025-02-21) Σ(TωT)

thread 'main' panicked at C:\Users\Chest\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\tauri-plugin-single-instance-2.2.1\src\platform_impl\windows.rs:121:34:
null pointer dereference occurred
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread caused non-unwinding panic. aborting.

It means it panicked at &mut *data_ptr; of the code below

unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
    hwnd: HWND,
    msg: u32,
    wparam: WPARAM,
    lparam: LPARAM,
) -> LRESULT {
    let data_ptr = GetWindowLongPtrW(hwnd, GWL_USERDATA)
        as *mut (AppHandle<R>, Box<SingleInstanceCallback<R>>);
    let (app_handle, callback) = &mut *data_ptr;   // Panicked here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: windows Windows specific issues plugin: single-instance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants