gtk4-rs
gtk4-rs copied to clipboard
[BUG] ` gtk4::Snapshot.to_node` cause crash
System: Host: rafalkom Kernel: 5.13.0-28-generic x86_64 bits: 64 compiler: gcc v: 11.2.0 Desktop: GNOME 40.5
tk: GTK 3.24.30 wm: gnome-shell dm: GDM3 Distro: Ubuntu 21.10 (Impish Indri)
RUST_BACKTRACE=full RUSTFLAGS=-Zsanitizer=address RUSTDOCFLAGS=-Zsanitizer=address cargo run -Zbuild-std --target x86_64-unknown-linux-gnu
Bug description
let thing = Snapshot::default(); // Snapshot
thing.to_node();
thing.to_node();
cause crash:
**
Gtk:ERROR:../../../gtk/gtksnapshot.c:237:gtk_snapshot_get_current_state: assertion failed: (size > 0)
Bail out! Gtk:ERROR:../../../gtk/gtksnapshot.c:237:gtk_snapshot_get_current_state: assertion failed: (size > 0)
Aborted (core dumped)
Issue found by fuzzer - https://github.com/qarmin/gtk-rs-fuzzer
to_node consumes the snapshot normally, I don't think there is anything actionable here. cc @sdroege ?
I guess the assertion in C could be a bit more descriptive, or to_node() could simply return NULL on the second call.
Well the message shared here seems to be wrong, it is a copy paste of an other issue opened lately. @qarmin mind updating that?
Yup, my bad, Updated assertion message
Not much more descriptive but better at least :) Your call if you want to improve the error handling in C. It will never work, but maybe it can explode more nicely.