Fix crash when cancelling an XMPP file transfer
Review Request #1485 — Created May 28, 2022 and submitted
When an XMPP account has file transfers and the connection to the XMPP server drops, the JabberStream object gets g_free()'d, but the PurpleXfers still have pointers to it, so when the file transfer finishes or is canceled, it tries to remove itself from the JabberStream object and it ends up accessing invalid memory, causing a crash. This patch closes all file transfers associated to a JabberStream object, right before the object gets g_free()'d.
Reliably reproduced the crash by closing internet connection while a transfer was in progress. After the patch, the crash no longer occurs because the transfers all end when the internet connection drops.
Summary | ID |
---|---|
6a43b9d5ac797ea77c83c3e6a4230ad67ce72716 |
Description | From | Last Updated |
---|---|---|
My only question is, will ending a file transfer cause the protocol side to remove it from js->file_transfers, thereby causing … |
QuLogic | |
if we're destroying the transfers and freeing them, it's probably best to use something like while(js->file_transfers != NULL) { purple_xfer_end(js->file_transfers->data); … |
grim | |
I'm torn on whether or not we should go with this or g_assert_reached... |
grim |
- Change Summary:
-
Ending a file transfer removes it from the
file_transfers
list, so
there's no need to iterate through the list, just check if a link really
has been removed (beacusejabber_si_xfer_free
callsg_list_remove
conditionally) and remove it manually if not. - Commits:
-
Summary ID 4b0d6160d170a1bb80755402320b37993dcba7d5 6a43b9d5ac797ea77c83c3e6a4230ad67ce72716