[Crash] Gajim crashes on multiple message corrections with the same ID in MUC
In Multi-User Chat, if one of participants sends message with id="test", then sends correction message with and with message id="test" as well, the exception is caused due to incorrect key in the list here:
It was deleted earlier in the code:
In console you have the following traceback:
<gajim.groupchat_control.GroupchatControl object at 0x7f385cf4f5e0>>
Traceback (most recent call last):
File "/app/lib/python3.8/site-packages/gajim/common/ged.py", line 101, in raise_event
if handler(*args, **kwargs):
File "/app/lib/python3.8/site-packages/gajim/common/helpers.py", line 1014, in func_wrapper
return func(self, event, *args, **kwargs)
File "/app/lib/python3.8/site-packages/gajim/groupchat_control.py", line 812, in _on_gc_message_received
self.add_message(event.msgtxt,
File "/app/lib/python3.8/site-packages/gajim/groupchat_control.py", line 895, in add_message
ChatControlBase.add_message(self,
File "/app/lib/python3.8/site-packages/gajim/chat_control_base.py", line 1158, in add_message
textview.print_conversation_line(text,
File "/app/lib/python3.8/site-packages/gajim/conversation_textview.py", line 977, in print_conversation_line
self.corrected_text_list[message_id])
KeyError: 'testid'
(org.gajim.Gajim:5): Gtk-CRITICAL **: 23:55:58.869: gtk_text_buffer_get_iter_at_mark: assertion '!gtk_text_mark_get_deleted (mark)' failed
However, if the user sends the same correction message, with the same IDs again (the second time), Gajim crashes somewhere in GTK (python process crashes).
In my case, the crash was permanent: after restarting Gajim, it crashed right after connecting to server, presumably due to dowloading MUC history.
The root cause of this issue is that Gajim does not filter repeating message IDs in MUC (it does for regular messages).
The naive fix for this issue is to remove this line:
The proper fix is to filter repeating message IDs in MUC.
Versions
- OS: Linux, Flatpak
- Gajim version: 1.3.2
- GTK version: 3.24.30
- Python-nbxmpp version: 2.0.3
Steps to reproduce the problem
- Connect to MUC
- Open XML console, send the following 4 times:
<message xmlns="jabber:client" to="yourmucroom@muc.jabberserver.address" type="groupchat" id="testid">
<body>test</body>
<replace xmlns="urn:xmpp:message-correct:0" id="testid" />
</message>
- Gajim (python) crashes.
Expected behavior
Gajim does not crash.