segfault in cm-enc.c after accepting invite
(the first time) joining a room (potentially a 1:1?) by accepting an invite led to a segfault
21:48:34.1516 cm-room-event-list[ 5698]: DEBUG: (0xffffa804c870) Parsing events 0xffff980160f0, state event: false, past events: false
21:48:34.1517 cm-enc[ 5698]: DEBUG: (0xaaaaabcca4b0) Got room encrypted, room: 0xffffa804c870. session: (nil)
21:48:34.1565 cm-enc[ 5698]: DEBUG: (0xaaaaabcca4b0) Got in group session 0xffffa80190c0 from matrix db
21:48:34.1573 cm-olm[ 5698]: WARNING: Error decrypting: UNKNOWN_MESSAGE_INDEX
Thread 1 "chatty" received signal SIGSEGV, Segmentation fault.
index () at ../sysdeps/aarch64/strchr.S:58
58 ../sysdeps/aarch64/strchr.S: No such file or directory.
(gdb) bt
#0 index () at ../sysdeps/aarch64/strchr.S:58
#1 0x0000fffff5b16744 in __GI_strstr (haystack=0x0, needle=0xaaaaaabddc60 "\"key_ops\"") at ./string/strstr.c:84
#2 0x0000aaaaaab81848 in cm_enc_handle_join_room_encrypted (self=0xaaaaabcca4b0, room=0xffffa804c870, object=0xffff98016430)
at ../subprojects/libcmatrix/src/cm-enc.c:1141
#3 0x0000aaaaaabab14c in event_list_decrypt (self=0xffffa804c9b0, root=0xffff980162d0)
at ../subprojects/libcmatrix/src/events/cm-room-event-list.c:464
#4 0x0000aaaaaabab33c in cm_room_event_list_parse_events
(self=0xffffa804c9b0, root=0xffff980160f0, events=0xaaaaae1c64c0, past=0)
at ../subprojects/libcmatrix/src/events/cm-room-event-list.c:516
#5 0x0000aaaaaab94d2c in cm_room_set_data (self=0xffffa804c870, object=0xffff98015fb0)
at ../subprojects/libcmatrix/src/cm-room.c:1152
#6 0x0000aaaaaab6d050 in handle_room_join (self=0xaaaaabccfb10, root=0xffff9800ef30)
at ../subprojects/libcmatrix/src/cm-client.c:2269
#7 0x0000aaaaaab6d70c in handle_red_pill (self=0xaaaaabccfb10, root=0xffff98003030)
at ../subprojects/libcmatrix/src/cm-client.c:2402
#8 0x0000aaaaaab6d9d0 in matrix_take_red_pill_cb (obj=0xaaaaadd76d80, result=0xaaaaae508890, user_data=0xaaaaabccfb10)
at ../subprojects/libcmatrix/src/cm-client.c:2444
#9 0x0000fffff7cf79f4 in () at /lib/aarch64-linux-gnu/libgio-2.0.so.0
#10 0x0000fffff7cf7a3c in () at /lib/aarch64-linux-gnu/libgio-2.0.so.0
#11 0x0000fffff7a7d520 in () at /lib/aarch64-linux-gnu/libglib-2.0.so.0
#12 0x0000fffff7a7f8dc in () at /lib/aarch64-linux-gnu/libglib-2.0.so.0
#13 0x0000fffff7a80088 in g_main_context_iteration () at /lib/aarch64-linux-gnu/libglib-2.0.so.0
#14 0x0000fffff7d2c790 in g_application_run () at /lib/aarch64-linux-gnu/libgio-2.0.so.0
#15 0x0000aaaaaaadf010 in main (argc=2, argv=0xfffffffff958) at ../src/main.c:37
(gdb) frame 2
#2 0x0000aaaaaab81848 in cm_enc_handle_join_room_encrypted (self=0xaaaaabcca4b0, room=0xffffa804c870, object=0xffff98016430)
at ../subprojects/libcmatrix/src/cm-enc.c:1141
1141 if (strstr (plaintext, "\"key_ops\""))
(gdb) l
1136
1137 g_return_val_if_fail (session, NULL);
1138
1139 plaintext = cm_olm_decrypt (session, 0, ciphertext);
1140
1141 if (strstr (plaintext, "\"key_ops\""))
1142 cm_enc_save_file_enc (self, plaintext);
1143
1144 return g_steal_pointer (&plaintext);
1145 }
(gdb) info locals
session = 0xffffa80190c0
sender_key = 0xffff9800f550 "FGLlNjLmVxmC+otWncBPbfeHVqiDEX8s6TZI0pC8F0g"
ciphertext = 0xffff98003940 "AwgNEpABiZbgujAM4oeo8Be9p83SDEgZobhtGaGlkfNIL1Ej0KaWy1qUHSjPsIpeIET3yptIbfuf51TQOk47DBhU1ZwFXmnfrIslvSyHf35194GonzFT3uY8jI1wbhJH3dRjTj6vrIPYdTAWwaEQmt2uFzGBwbt6wiqam+shv0ufsOr5+l167Gplyo6Vm7In+6lXTYT1"...
session_id = 0xffff9800f620 "l8SjNIhUrXRfxgxyMTLET4IpODGtIe0WJXIb042jymM"
plaintext = 0x0
__func__ = "cm_enc_handle_join_room_encrypted"
on the second startup I could the channel was already joined, but opening it up again caused another segfault:
22:37:43.1256 cm-olm[ 5865]: WARNING: Error decrypting: UNKNOWN_MESSAGE_INDEX
Thread 1 "chatty" received signal SIGSEGV, Segmentation fault.
index () at ../sysdeps/aarch64/strchr.S:58
58 ../sysdeps/aarch64/strchr.S: No such file or directory.
(gdb) bt
#0 index () at ../sysdeps/aarch64/strchr.S:58
#1 0x0000fffff5b16744 in __GI_strstr (haystack=0x0, needle=0xaaaaaabddc60 "\"key_ops\"") at ./string/strstr.c:84
#2 0x0000aaaaaab81848 in cm_enc_handle_join_room_encrypted (self=0xaaaaabd93550, room=0xffffb004d5f0, object=0xffffdc071480)
at ../subprojects/libcmatrix/src/cm-enc.c:1141
#3 0x0000aaaaaabab14c in event_list_decrypt (self=0xffffb004d730, root=0xffffdc071340)
at ../subprojects/libcmatrix/src/events/cm-room-event-list.c:464
#4 0x0000aaaaaabab33c in cm_room_event_list_parse_events
(self=0xffffb004d730, root=0xffffdc021190, events=0xffffb00666d0, past=1)
at ../subprojects/libcmatrix/src/events/cm-room-event-list.c:516
#5 0x0000aaaaaab98b7c in room_load_prev_batch_cb (obj=0xaaaaabd64110, result=0xaaaaae4d7ae0, user_data=0xaaaaadde9ac0)
at ../subprojects/libcmatrix/src/cm-room.c:2237
#6 0x0000fffff7cf79f4 in () at /lib/aarch64-linux-gnu/libgio-2.0.so.0
#7 0x0000fffff7cf7a3c in () at /lib/aarch64-linux-gnu/libgio-2.0.so.0
#8 0x0000fffff7a7d520 in () at /lib/aarch64-linux-gnu/libglib-2.0.so.0
#9 0x0000fffff7a7f8dc in () at /lib/aarch64-linux-gnu/libglib-2.0.so.0
#10 0x0000fffff7a80088 in g_main_context_iteration () at /lib/aarch64-linux-gnu/libglib-2.0.so.0
#11 0x0000fffff7d2c790 in g_application_run () at /lib/aarch64-linux-gnu/libgio-2.0.so.0
#12 0x0000aaaaaaadf010 in main (argc=2, argv=0xfffffffff958) at ../src/main.c:37
(gdb) frame 2
#2 0x0000aaaaaab81848 in cm_enc_handle_join_room_encrypted (self=0xaaaaabd93550, room=0xffffb004d5f0, object=0xffffdc071480)
at ../subprojects/libcmatrix/src/cm-enc.c:1141
1141 if (strstr (plaintext, "\"key_ops\""))
(gdb) info locals
session = 0xffffb001c420
sender_key = 0xffffdc071cd0 "FGLlNjLmVxmC+otWncBPbfeHVqiDEX8s6TZI0pC8F0g"
ciphertext = 0xffffdc071ec0 "AwgPEsAJtVHWsuyVHkJBaWe5gjyXQs0ltHDpVX0FbDJsNKFEjeRanRD2Z7ZtbTR6M0L7CYnR+K9pvhYFLRnsso7GOonTS1yr0g4PiU6TgVlqPAVfapmrn/H3wYgqGoZOYgL0PPkKfqfN1zymNszmlo8H0yuPNi+ERD7COgvpSou7C8KEAd51xM+gCnCbPNPIAJ/UuHLa5D3ovv5yymSo38HNRfDwUtzQSS3LRFwrEM5UcIZVfJzjRNGgGc7BkSw5HT8hGtrx/xNylFPR//sOVAIe6EteRfyTylrDpe3H0l9d8iqwIonFLxDio7vz6ooFC0DVnCb7hxpMwDjvX3c1Yvd4LydXii6A5w3J45caxgWBJTUYQK9EANop8y3ZrNB3SaP12E02qctOP/qvt8dCVHFDH5Q+ad853fKY52gvmfhAYOwnvQyr3fpwDIjoY96qt2DLsgv66ymHfbHpTpA9dve2yFEM8xDYiWDTN8JA/hLnmiwICPc8RhXYUVn/sa+UYJ97qjLrz7ayBKN5T+hBOlago/e2Q/z52q3JuuBR87dImr8tVIiRu2rIdfoTtUAu3FKmSZSdZRKjC3H+y7QJjI5n9NH25xXKLPV5Z2k/nA9+FDLK/3ueNWLxgJWjqaIPooZbci3xmJ02H+TRhwPPV9Skn5Dri6PkQhd7i55XcErWUObMYu3pvDtpddx4Ni4D2L/f+A6Z/OI8+qRgv/VNLEhpFOE08C/e0vrsPW74uANXmSbVg8VgYGQ9SCSMbWvBh5QdPCQX4OSo6SZGcIoA2UGZ5e+OQoqucqwX2bfU+gUlfpeWK/OmfHQHYdYOQpU715wwUIsZ44AZ9e4fe//s8uAfkSsVHAeVas6A5Y62u9/wZaJmyuMTnT1mA0t+O70BpWRV9HOenb9X6CgkdbtGVRRivLulDss6MwQtP+mlLgsjppMKOhp35PTWUiBrNaVgKMXRPrOO5gK6yXSsWj2vj5FUh0RLWL5pBT3EP6wstM9zgxWiQlTP3TsZzl/sTSxyvyqvMDa1ZXNOs5rM7Lr80cbjaOk2by0lg3AetVBcmHTlVNiBpYr3Ki3E4v9mxejIA5nlPmM79RNWVHHI3ACQ91qbisCe1XbWtgPvsESwk9uX0U8dFh63nlHLM4Uhz+ai+5nwHdqBJPq6C/ZR5kck74XGXJntY7nNJzBeY7WY7k4TgRuqexh0Lk8GKtnrijtm2ldGFDc+Rcg4m5sj5tj74CkXh18EVWeD1h6A9PFfb0TAZJp4vzWhRKRKO1KZ1kTCKK828L138JsL1hreLb52R41Z3p+E4TgTx84JQeQlgKtJA4GjH4HBgklM2rs8dtp5zpvU97tuNfPdPEMbYl/Q8OlpN10JCIA9BfWToMJj+rLdLQ8aOmz3UTjvAiecFOfWaZrR6m9Xu6FQJsrgEpxHOF2IfiXQL6odxdYD7mERaKwdb3elMjBpW9B25IPXPEDnG5xoRFzaqyal2KZC1BdswUaP2jXmVqvNRUBdH6dRyStTu+ljmM0onPW9YxV64420UImhSFYRzK/uLik2CrArNF6MSiuCTPDTXizAi1hEUzyUJ+B4mNJ5L3DXA1SbFw8S/VM7g/Y1Umz2SmbaeUbwtpPk1nyeujD/s2LpKEBKcKvq4RVW4NHDAn6DeFIXJOjlW3elno8jrdw4gW1ILr40y7PkjQFf1hhaWSNmJdEqXBn4nqJvuF5SKfSo0owiCg"
session_id = 0xffffdc071d70 "l8SjNIhUrXRfxgxyMTLET4IpODGtIe0WJXIb042jymM"
plaintext = 0x0
__func__ = "cm_enc_handle_join_room_encrypted"
attaching a log from the first join attempt: