astroidmail / astroid

A graphical threads-with-tags style, lightweight and fast, e-mail client for Notmuch
http://astroidmail.github.io
Other
613 stars 65 forks source link

segfault when attaching a file to an email #726

Closed mklinik closed 1 year ago

mklinik commented 1 year ago

I'm getting a segfault when trying to attach a file to an email.

Steps to reproduce:

Result: astroid crashes with Segmentation fault (core dumped)

I'm using astroid compiled from source, current master 7c2022f06a4146ad62e858bcaacdb4ee817851b9, Arch linux.

Here is a complete log of the procedure described above in gdb, with backtrace after the segfault happened https://gist.github.com/mklinik/f15cab0a048cbc95e84d6161b6c5975b

The last message I sent with attachment was on Feb 22 2023, back then it still worked. I updated Arch and recompiled astroid, same result.

stephancb commented 1 year ago

Not reproduced on Fedora 37: I recompiled two days ago (new laptop), and then sent emails with attachment (also using vim as external editor).

saro commented 1 year ago

@mklinik I can reproduce this as well. I did a system update recently and I see that webkit2gtk has been updated. I suspect that this may be the reason of this crash and the other issues I'm now seeing with the rendering of the text and HTML emails.

EDIT: I reverted to webkit2gtk-2.38.5-1 and it has solved the rendering issues but not the attachment segfault.

EDIT2: It seems that this is a more general issue triggered by last glib update to version 2.76 (see https://github.com/Qalculate/qalculate-gtk/issues/473 )

stephancb commented 1 year ago

Found it!

src/compose_message.cc:784

- refptr fle = Glib::wrap (file, false); +refptr fle = Glib::wrap (file, true);

wrap needs to copy all fields of file. Only in the latest update of GLib the wrap(.., false) seems to segfault, before it probably by chance went unnoticed.

Should I attempt to create a pull request?

gauteh commented 1 year ago

For sure!

mklinik commented 1 year ago

Awesome! Thank you so much @stephancb for figuring it out and fixing it.

noideawhatwhat commented 8 months ago

Arch linux has this as the latest build

extra/astroid 0.16-11 [installed] A graphical threads-with-tags style, lightweight and fast, e-mail client for Notmuch

The Arch version segmentation faults when attaching a file to an email in the same way as above.

Webkit version in Arch is webkit2gtk-4.1 2.42.4-2 so it seems to fit.

Is there any chance of a release with this fix? That would likely lead to Arch updating its package.