Giter Club home page Giter Club logo

libomemo's People

Contributors

aluaces avatar dependabot[bot] avatar fortysixandtwo avatar gkdr avatar hartwork avatar hasufell avatar msantos avatar neustradamus avatar rmader avatar shtrom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

libomemo's Issues

Change default namespace

Now that the namespace Conversations has been using is actually official, the default in this lib should be adopted.

12 byte IV for outgoing messages

Rework build

  • Get rid of libtool
  • Actually make a build that does not depend on SQLite
  • Offer build as shared lib (#9)

Sending tag appended to key

The tag should be encrypted by the double ratchet session as well, instead of being appended to the payload.
Parsing functionality is already there, and now clients started switching to sending it, so this lib should do it too.

memory leaks in test_storage

When running test_storage with address sanitizer, the following memory leaks are found.

To reproduce:

git clone https://github.com/hades/libomemo.git
cd libomemo
git checkout efcf195c243e95131b49d83209b232b70b1e2f27
mkdir build ; cd build
CC=clang cmake .. -DOMEMO_WITH_ASAN=ON
make
ctest --output-on-failure

Error output:

=================================================================
==15719==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x7f4a46648948 in g_malloc /usr/src/glib2.0-2.76.1-1/debian/build/deb/../../../glib/gmem.c:130:13

Direct leak of 10 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b344b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x5597d08b6fba in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x5597d08bd428 in omemo_storage_user_devicelist_retrieve /home/hades/dev/libomemo/test/../src/libomemo_storage.c:214:15
    #4 0x5597d08beafc in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:82:3
    #5 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b344b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x5597d08b6fba in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x5597d08bd428 in omemo_storage_user_devicelist_retrieve /home/hades/dev/libomemo/test/../src/libomemo_storage.c:214:15
    #4 0x5597d08be904 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:74:3
    #5 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 144 byte(s) in 6 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x7f4a46648948 in g_malloc /usr/src/glib2.0-2.76.1-1/debian/build/deb/../../../glib/gmem.c:130:13

Indirect leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08bec39 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:85:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08bece8 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:86:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08beb8a in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:84:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08bea41 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:78:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08be992 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:77:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

SUMMARY: AddressSanitizer: 239 byte(s) leaked in 19 allocation(s).

uninitialized memory usage in db_conn_open_and_prepare when running test_storage

Uninitialized bytes in __interceptor_strlen at offset 0 inside [0x719000000008, 43)
==16613==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7fe266ac7df1 in sqlite3Strlen30 /build/sqlite3-tqfYqM/sqlite3-3.40.1/./src/util.c:81:28
    #1 0x7fe266a92c75 in sqlite3PagerOpen /build/sqlite3-tqfYqM/sqlite3-3.40.1/./src/pager.c:4739:17
    #2 0x7fe266a17204 in sqlite3BtreeOpen /build/sqlite3-tqfYqM/sqlite3-3.40.1/./src/btree.c:2577:10
    #3 0x7fe266a8e172 in openDatabase /build/sqlite3-tqfYqM/sqlite3-3.40.1/./src/main.c:3406:8
    #4 0x5622240c49f7 in db_conn_open_and_prepare /home/hades/dev/libomemo/test/../src/libomemo_storage.c:46:13
    #5 0x5622240c4396 in omemo_storage_user_device_id_save /home/hades/dev/libomemo/test/../src/libomemo_storage.c:106:13
    #6 0x5622240c7651 in test_devicelist_save_id /home/hades/dev/libomemo/test/test_storage.c:34:17
    #7 0x7fe266de7aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13
    #8 0x7fe266de8192 in cmocka_run_one_tests obj-x86_64-linux-gnu/src/./src/cmocka.c:2909:14
    #9 0x7fe266de8192 in _cmocka_run_group_tests obj-x86_64-linux-gnu/src/./src/cmocka.c:3040:18
    #10 0x5622240c9387 in main /home/hades/dev/libomemo/test/test_storage.c:156:10
    #11 0x7fe266623a8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #12 0x7fe266623b48 in __libc_start_main csu/../csu/libc-start.c:360:3
    #13 0x562224026584 in _start (/home/hades/dev/libomemo/build/test_storage+0x25584) (BuildId: 4d90a763c74f8bf950fe633297af2d17a6b0b303)

License info in each source file

Please add license info into all *.c and *.h files. This is recommended by FSF, for example. And this practice is widely used in FOSS.

memory leaks in test_libomemo

When running test_libomemo with address sanitizer, the following memory leaks are found.

To reproduce:

git clone https://github.com/hades/libomemo.git
cd libomemo
git checkout efcf195c243e95131b49d83209b232b70b1e2f27
mkdir build ; cd build
CC=clang cmake .. -DOMEMO_WITH_ASAN=ON
make
ctest --output-on-failure

Error output:

=================================================================
==15714==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1436 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b51d373 in strdup (/home/hades/dev/libomemo/build/test_libomemo+0x97373) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad4b0f in mxmlSaveAllocString /build/mxml-ZxgGso/mxml-3.3.1/mxml-file.c:226:13
    #2 0x563b1b57bc13 in test_bundle_export /home/hades/dev/libomemo/test/test_libomemo.c:440:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 79 byte(s) in 7 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19b3e948 in g_malloc /usr/src/glib2.0-2.76.1-1/debian/build/deb/../../../glib/gmem.c:130:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b581186 in test_message_export_encrypted_strip_xhtml /home/hades/dev/libomemo/test/test_libomemo.c:1052:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b57fd26 in test_message_add_recipient /home/hades/dev/libomemo/test/test_libomemo.c:905:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b580b54 in test_message_export_encrypted_with_extra_tags_and_body /home/hades/dev/libomemo/test/test_libomemo.c:999:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b581ccb in test_message_export_encrypted_with_eme /home/hades/dev/libomemo/test/test_libomemo.c:1155:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b581516 in test_message_export_encrypted_strip_multiple_body /home/hades/dev/libomemo/test/test_libomemo.c:1085:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b57dbcc in test_message_prepare_encryption /home/hades/dev/libomemo/test/test_libomemo.c:693:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b580166 in test_message_add_recipient_w_prekey /home/hades/dev/libomemo/test/test_libomemo.c:937:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b57483d in omemo_message_prepare_decryption /home/hades/dev/libomemo/test/../src/libomemo.c:1314:11
    #2 0x563b1b58308a in test_message_encrypt_decrypt_with_extra_nodes /home/hades/dev/libomemo/test/test_libomemo.c:1260:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b57483d in omemo_message_prepare_decryption /home/hades/dev/libomemo/test/../src/libomemo.c:1314:11
    #2 0x563b1b5842fb in test_message_encrypt_decrypt_with_added_eme /home/hades/dev/libomemo/test/test_libomemo.c:1356:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b583a7b in test_message_encrypt_decrypt_with_added_body /home/hades/dev/libomemo/test/test_libomemo.c:1305:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b57483d in omemo_message_prepare_decryption /home/hades/dev/libomemo/test/../src/libomemo.c:1314:11
    #2 0x563b1b57fae2 in test_message_get_encrypted_key_no_keys /home/hades/dev/libomemo/test/test_libomemo.c:888:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b57e443 in test_message_prepare_encryption_with_extra_data /home/hades/dev/libomemo/test/test_libomemo.c:725:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b584852 in test_message_get_names /home/hades/dev/libomemo/test/test_libomemo.c:1391:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b57483d in omemo_message_prepare_decryption /home/hades/dev/libomemo/test/../src/libomemo.c:1314:11
    #2 0x563b1b582588 in test_message_encrypt_decrypt /home/hades/dev/libomemo/test/test_libomemo.c:1208:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b58419b in test_message_encrypt_decrypt_with_added_eme /home/hades/dev/libomemo/test/test_libomemo.c:1346:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b582410 in test_message_encrypt_decrypt /home/hades/dev/libomemo/test/test_libomemo.c:1198:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b582f18 in test_message_encrypt_decrypt_with_extra_nodes /home/hades/dev/libomemo/test/test_libomemo.c:1250:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b5818a6 in test_message_export_encrypted_strip_xhtml_and_body /home/hades/dev/libomemo/test/test_libomemo.c:1125:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b57db8f in test_message_prepare_encryption /home/hades/dev/libomemo/test/test_libomemo.c:691:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b57483d in omemo_message_prepare_decryption /home/hades/dev/libomemo/test/../src/libomemo.c:1314:11
    #2 0x563b1b583bdb in test_message_encrypt_decrypt_with_added_body /home/hades/dev/libomemo/test/test_libomemo.c:1315:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b580547 in test_message_export_encrypted /home/hades/dev/libomemo/test/test_libomemo.c:962:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b572365 in omemo_message_create /home/hades/dev/libomemo/test/../src/libomemo.c:1005:11
    #2 0x563b1b573062 in omemo_message_prepare_encryption /home/hades/dev/libomemo/test/../src/libomemo.c:1095:13
    #3 0x563b1b57eb4f in test_message_get_key /home/hades/dev/libomemo/test/test_libomemo.c:756:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b57483d in omemo_message_prepare_decryption /home/hades/dev/libomemo/test/../src/libomemo.c:1314:11
    #2 0x563b1b57ed72 in test_message_get_encrypted_key /home/hades/dev/libomemo/test/test_libomemo.c:779:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b57483d in omemo_message_prepare_decryption /home/hades/dev/libomemo/test/../src/libomemo.c:1314:11
    #2 0x563b1b57f792 in test_message_get_encrypted_key_after_iv /home/hades/dev/libomemo/test/test_libomemo.c:860:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b57483d in omemo_message_prepare_decryption /home/hades/dev/libomemo/test/../src/libomemo.c:1314:11
    #2 0x563b1b57f0b0 in test_message_is_encrypted_key_prekey /home/hades/dev/libomemo/test/test_libomemo.c:816:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d1b5 in omemo_bundle_create /home/hades/dev/libomemo/test/../src/libomemo.c:164:29
    #2 0x563b1b57b7f6 in test_bundle_export /home/hades/dev/libomemo/test/test_libomemo.c:417:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d1b5 in omemo_bundle_create /home/hades/dev/libomemo/test/../src/libomemo.c:164:29
    #2 0x563b1b57a62a in test_bundle_set_device_id /home/hades/dev/libomemo/test/test_libomemo.c:321:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 14 byte(s) in 2 object(s) allocated from:
    #0 0x563b1b533228 in __interceptor_calloc (/home/hades/dev/libomemo/build/test_libomemo+0xad228) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19b3f550 in g_malloc0 /usr/src/glib2.0-2.76.1-1/debian/build/deb/../../../glib/gmem.c:163:13

Direct leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b570a72 in omemo_devicelist_import /home/hades/dev/libomemo/test/../src/libomemo.c:759:28
    #2 0x563b1b578a43 in test_devicelist_remove /home/hades/dev/libomemo/test/test_libomemo.c:179:3
    #3 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b570fea in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x563b1b578889 in test_devicelist_contains_id /home/hades/dev/libomemo/test/test_libomemo.c:170:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b570fea in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x563b1b5786ca in test_devicelist_contains_id /home/hades/dev/libomemo/test/test_libomemo.c:162:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b570fea in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x563b1b578145 in test_devicelist_add /home/hades/dev/libomemo/test/test_libomemo.c:136:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b570fea in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x563b1b579ac2 in test_devicelist_export /home/hades/dev/libomemo/test/test_libomemo.c:246:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b570fea in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x563b1b579a7b in test_devicelist_export /home/hades/dev/libomemo/test/test_libomemo.c:245:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b570fea in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x563b1b5795f6 in test_devicelist_diff /home/hades/dev/libomemo/test/test_libomemo.c:228:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b570fea in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x563b1b5795a6 in test_devicelist_diff /home/hades/dev/libomemo/test/test_libomemo.c:227:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b570fea in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x563b1b579337 in test_devicelist_diff /home/hades/dev/libomemo/test/test_libomemo.c:219:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 5984 byte(s) in 68 object(s) allocated from:
    #0 0x563b1b533228 in __interceptor_calloc (/home/hades/dev/libomemo/build/test_libomemo+0xad228) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad3fe1 in mxml_new /build/mxml-ZxgGso/mxml-3.3.1/mxml-node.c:836:15
    #2 0x7f3e19ad3fe1 in mxmlNewElement /build/mxml-ZxgGso/mxml-3.3.1/mxml-node.c:382:15

Indirect leak of 4840 byte(s) in 55 object(s) allocated from:
    #0 0x563b1b533228 in __interceptor_calloc (/home/hades/dev/libomemo/build/test_libomemo+0xad228) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad40b1 in mxml_new /build/mxml-ZxgGso/mxml-3.3.1/mxml-node.c:836:15
    #2 0x7f3e19ad40b1 in mxmlNewOpaque /build/mxml-ZxgGso/mxml-3.3.1/mxml-node.c:451:15

Indirect leak of 577 byte(s) in 68 object(s) allocated from:
    #0 0x563b1b51d373 in strdup (/home/hades/dev/libomemo/build/test_libomemo+0x97373) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad400f in mxmlNewElement /build/mxml-ZxgGso/mxml-3.3.1/mxml-node.c:383:32

Indirect leak of 496 byte(s) in 31 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad4d5e in mxml_set_attr /build/mxml-ZxgGso/mxml-3.3.1/mxml-attr.c:322:12

Indirect leak of 481 byte(s) in 59 object(s) allocated from:
    #0 0x563b1b51d373 in strdup (/home/hades/dev/libomemo/build/test_libomemo+0x97373) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad4e0d in mxmlElementSetAttr /build/mxml-ZxgGso/mxml-3.3.1/mxml-attr.c:221:19
    #2 0x7f3e19ad4e0d in mxmlElementSetAttr /build/mxml-ZxgGso/mxml-3.3.1/mxml-attr.c:200:1

Indirect leak of 448 byte(s) in 12 object(s) allocated from:
    #0 0x563b1b533466 in __interceptor_realloc (/home/hades/dev/libomemo/build/test_libomemo+0xad466) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad4db2 in mxml_set_attr /build/mxml-ZxgGso/mxml-3.3.1/mxml-attr.c:324:12

Indirect leak of 445 byte(s) in 55 object(s) allocated from:
    #0 0x563b1b51d373 in strdup (/home/hades/dev/libomemo/build/test_libomemo+0x97373) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad40e5 in mxmlNewOpaque /build/mxml-ZxgGso/mxml-3.3.1/mxml-node.c:452:26

Indirect leak of 399 byte(s) in 59 object(s) allocated from:
    #0 0x563b1b51d373 in strdup (/home/hades/dev/libomemo/build/test_libomemo+0x97373) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x7f3e19ad4d80 in mxml_set_attr /build/mxml-ZxgGso/mxml-3.3.1/mxml-attr.c:337:21

Indirect leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b56d330 in omemo_bundle_set_device_id /home/hades/dev/libomemo/test/../src/libomemo.c:177:13
    #3 0x563b1b57bae6 in test_bundle_export /home/hades/dev/libomemo/test/test_libomemo.c:432:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x563b1b53303e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_libomemo+0xad03e) (BuildId: 430d8118ea580c8c9db54c4182f11db0faed2305)
    #1 0x563b1b56d47b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x563b1b56d330 in omemo_bundle_set_device_id /home/hades/dev/libomemo/test/../src/libomemo.c:177:13
    #3 0x563b1b57a671 in test_bundle_set_device_id /home/hades/dev/libomemo/test/test_libomemo.c:323:3
    #4 0x7f3e19d73aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

SUMMARY: AddressSanitizer: 16961 byte(s) leaked in 456 allocation(s).

uninitialized memory usage in test_devicelist_create when running test_libomemo

Uninitialized bytes in __interceptor_strcmp at offset 5 inside [0x701000000000, 6)
==16609==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f5f0a5362ce in string_equal_display_error obj-x86_64-linux-gnu/src/./src/cmocka.c:1296:9
    #1 0x7f5f0a5362ce in _assert_string_equal obj-x86_64-linux-gnu/src/./src/cmocka.c:1816:10
    #2 0x5628234dff5d in test_devicelist_create /home/hades/dev/libomemo/test/test_libomemo.c:61:3
    #3 0x7f5f0a536aab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13
    #4 0x7f5f0a537192 in cmocka_run_one_tests obj-x86_64-linux-gnu/src/./src/cmocka.c:2909:14
    #5 0x7f5f0a537192 in _cmocka_run_group_tests obj-x86_64-linux-gnu/src/./src/cmocka.c:3040:18
    #6 0x5628234f1d57 in main /home/hades/dev/libomemo/test/test_libomemo.c:1452:10
    #7 0x7f5f09e23a8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #8 0x7f5f09e23b48 in __libc_start_main csu/../csu/libc-start.c:360:3
    #9 0x56282343f5b4 in _start (/home/hades/dev/libomemo/build/test_libomemo+0x265b4) (BuildId: f0f27f1571dfa7d462937446f58512578187038c)

Flaky test "test_aes_gcm_encrypt_decrypt" in test_crypto.c?

It seems like one of the tests is flaky, at least on Windows:

 [ RUN      ] test_aes_gcm_encrypt_decrypt
[  ERROR   ] --- 0x0 != 0xffffffffffffd8dc
[   LINE   ] --- D:/a/libomemo/libomemo/test/test_crypto.c:79: error: Failure!

Would be cool to understand and become stable.

More permissive license

Please consider switching to more permissive license. At least to "LGPLv2.1 or later". BSD-2-Clause or MIT would be even better.

With current license there is almost zero chance that your library will be used in open-source software licensed not under GPL.

Refactoring - Splitting the main file

Since libomemo.c turned out to be bigger than anticipated, it should be split into a module/file per data type before the work for OMEMOv2 begins, when it finally gets accepted.

XEP-0384: OMEMO Encryption 0.4.0+

Can you update the XEP-0384: OMEMO Encryption support to 0.4.0+?

And XEP-0454: OMEMO Media sharing:

Diff Tool:

PS: Not sure that 0.3.0 was complete before:

more specific error codes

to make remote debugging easier when nothing is obviously wrong, the error codes should be more specific (e.g. not always the same OMEMO_ERR_MALFORMED_XML, and possibly others).

Segfault in omemo_devicelist_import

While porting lurch.c to shmoose (XMPP Client for SailfishOS), I encountered a Segfault in the function omemo_devicelist_import of libomeo.c

When I pass a pointer to a char array with content like:

     char * array = "<items node=\"eu.siacs.conversations.axolotl.devicelist\"> \
       <item id=\"COFFEEBABE\"> \
        <list xmlns=\"eu.siacs.conversations.axolotl\"> \
         <device id=\"1234567890\"></device> \
        </list> \
       </item> \
      </items>";

in the function, it crashes at
ret_val = strncmp(mxmlGetElement(item_node_p), ITEM_NODE_NAME, strlen(ITEM_NODE_NAME));

Using gdb, I figured out that the (items) node
items_node_p = mxmlLoadString((void *) 0, received_devicelist, MXML_NO_CALLBACK);
is successfull assigned. All required members of the struct are correct filled. The next call to

item_node_p = mxmlGetFirstChild(items_node_p);
returns a valid (item) node, but the needed members of the struct are not valid. Thus, the mentioned call to mxmlGetElement(item_node_p) results in a read of an uninitialized pointer, causes the segfault.

My testing environment is a Debian stable with libmxml 2.10. I also tried the 2.7 version, as mentioned in the readme of lurch. Same issue.

Any hints about that?

Add support for different crypto backends

Hello,
as libomemo uses only quite basic functionality from libgcrypt (afaik) , I'd like to make it work with other backends as well, like nss or openssl.
That would make it easier for many projects to include libomemo (for example Thunderbird, which uses nss as it's only crypto backend).

Would you generally accept patches in this direction? It would increase complexity a bit and definitely needs to get reviewed by experienced people, but I think there are some at my university to help with that.

Cheers at thanks for this project!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.