gtk4-rs icon indicating copy to clipboard operation
gtk4-rs copied to clipboard

[BUG] `gtk4::WindowControls.add_mnemonic_label` cause crash

Open qarmin opened this issue 3 years ago • 0 comments

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

for _i in 0..100{
let thing = WindowControls::default(); // WindowControls
thing.add_mnemonic_label(&Picture::new());
thing.first_child();
thing.insert_before(&EmojiChooser::new(),Some(FontButton::new()).as_ref());
thing.add_mnemonic_label(&Entry::default());
}

cause panic:

(crash_thing:86724): Gtk-CRITICAL **: 21:51:48.051: gtk_widget_insert_before: assertion 'next_sibling == NULL || _gtk_widget_get_parent (next_sibling) == parent' failed

(crash_thing:86724): GLib-GObject-CRITICAL **: 21:51:48.053: g_object_weak_ref: assertion 'G_IS_OBJECT (object)' failed

(crash_thing:86724): GLib-GObject-WARNING **: 21:51:48.054: invalid unclassed pointer in cast to 'GObject'

(crash_thing:86724): GLib-GObject-CRITICAL **: 21:51:48.054: g_object_weak_unref: assertion 'G_IS_OBJECT (object)' failed

(crash_thing:86724): Gtk-CRITICAL **: 21:51:48.059: gtk_widget_insert_before: assertion 'next_sibling == NULL || _gtk_widget_get_parent (next_sibling) == parent' failed
AddressSanitizer:DEADLYSIGNAL
=================================================================
==86724==ERROR: AddressSanitizer: SEGV on unknown address 0x00003580003c (pc 0x7f358a7b70c0 bp 0x7f358a29ed80 sp 0x7fff4eb3bb48 T0)
==86724==The signal is caused by a READ memory access.
    #0 0x7f358a7b70c0  (/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x370c0)
    #1 0x7f358a79d18e  (/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1d18e)
    #2 0x7f358a43942e  (/lib/x86_64-linux-gnu/libgtk-4.so.1+0x4a042e)
    #3 0x7f358a0515f9  (/lib/x86_64-linux-gnu/libgtk-4.so.1+0xb85f9)
    #4 0x7f358a28fa7e  (/lib/x86_64-linux-gnu/libgtk-4.so.1+0x2f6a7e)
    #5 0x55c8b82a4705  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x323705)
    #6 0x55c8b82ad470  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x32c470)
    #7 0x55c8b82aa947  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x329947)
    #8 0x55c8b82afe4a  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x32ee4a)
    #9 0x7f358a793c0e  (/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x13c0e)
    #10 0x7f358a7afea5  (/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2fea5)
    #11 0x7f358a7b1883  (/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x31883)
    #12 0x7f358a7b1ad2  (/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x31ad2)
    #13 0x7f3589ccc9d7  (/lib/x86_64-linux-gnu/libgio-2.0.so.0+0xdb9d7)
    #14 0x7f3589cccbb5  (/lib/x86_64-linux-gnu/libgio-2.0.so.0+0xdbbb5)
    #15 0x55c8b82a96d8  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x3286d8)
    #16 0x55c8b82a90c7  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x3280c7)
    #17 0x55c8b82ac666  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x32b666)
    #18 0x55c8b82af50a  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x32e50a)
    #19 0x55c8b82a4a04  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x323a04)
    #20 0x55c8b82a4363  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x323363)
    #21 0x55c8b8ac68dd  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0xb458dd)
    #22 0x55c8b8ad499e  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0xb5399e)
    #23 0x55c8b8addb7a  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0xb5cb7a)
    #24 0x55c8b8ad3c62  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0xb52c62)
    #25 0x55c8b8884fd9  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x903fd9)
    #26 0x55c8b8921e9b  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x9a0e9b)
    #27 0x55c8b8ad47cd  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0xb537cd)
    #28 0x55c8b8addb7a  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0xb5cb7a)
    #29 0x55c8b8ad360b  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0xb5260b)
    #30 0x55c8b88852c9  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x9042c9)
    #31 0x55c8b89217e9  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x9a07e9)
    #32 0x55c8b82a42c5  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x3232c5)
    #33 0x55c8b82ad67b  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x32c67b)
    #34 0x7f35897c0fcf  (/lib/x86_64-linux-gnu/libc.so.6+0x2dfcf)
    #35 0x7f35897c107c  (/lib/x86_64-linux-gnu/libc.so.6+0x2e07c)
    #36 0x55c8b82141e4  (/home/rafal/Pulpit/AAA/target/x86_64-unknown-linux-gnu/debug/crash_thing+0x2931e4)

Issue found by fuzzer - https://github.com/qarmin/gtk-rs-fuzzer

qarmin avatar Feb 14 '22 20:02 qarmin