Commit Graph

894 Commits (wip-clang-format)

Author SHA1 Message Date
Denis Kasak 68d83e43d7 Use proper enum value for Language directive. 2021-07-01 12:12:42 +02:00
Denis Kasak d5d379fe2a Add preliminary .clang-format file.
Our current coding style is not very uniform and we don't seem to be
following any particular standard, even though there are some patterns
we more or less follow.

This attempts to mostly reproduce our current style. However, it still
introduces quite a lot of changes since clang-format doesn't yet support
dangling parentheses[*] (where the closing parenthesis of a parameter
list goes on its own line).

[*]: https://reviews.llvm.org/D33029
2021-06-30 16:45:37 +02:00
Johannes Hayeß 254a4a5619 Fix building of tests with MSVC
Hi,

currently tests don't build with MSVC, because the Base64 test tries to initialize multiple arrays with a length value that was derived from a non-const context. I have fixed this by using vectors instead.

Sincerely

Johannes Hayeß

From 2d76972a862f0aa04b5011537bef71a49aa82a03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johannes=20Haye=C3=9F?= <jhaye@mailbox.org>
Date: Sun, 27 Jun 2021 17:46:24 +0200
Subject: [PATCH] Fix compiling with MSVC
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Previously attempts to initialize arrays with non-const value. This
seemingly works on GCC/clang due to their static code analysis, but
fails with MSVC. This switches to dynamic memory allocation with
std::vector, to solve the problem.

Signed-off-by: Johannes Hayeß <jhaye@mailbox.org>
2021-06-29 13:14:05 -04:00
Hubert Chathi abf8f97491 fix JavaScript build 2021-06-18 13:12:11 -04:00
Hubert Chathi 0f7c13334f install error.h when using make too 2021-06-17 15:26:46 -04:00
Hubert Chathi 2aad86ea84 fix Python build 2021-06-17 11:56:08 -04:00
Denis Kasak 9a8b421903 Update dart-olm URL. 2021-06-17 16:20:48 +02:00
Hubert Chathi 37c8e14e53 make functions const where possible 2021-06-16 23:22:25 -04:00
Hubert Chathi 7263c4221b add functions to get the error codes rather than error strings 2021-06-16 22:40:14 -04:00
Hubert Chathi 60be1ca55f add support file for cross-compiling Windows library 2021-06-16 15:28:30 -04:00
Hubert Chathi 1b7973626e only export olm functions to avoid colliding with other libraries 2021-06-16 15:05:19 -04:00
Hubert Chathi d47c2a92b8 make new pickle/unpickle function 2021-06-09 14:59:31 +00:00
Hubert Chathi 4803f4192d make (de)serialize methods public in OlmAccount 2021-06-09 14:59:31 +00:00
Hubert Chathi 3612ac7ae7 add missing dependency in Makefile for javascript/olm_prefix.js 2021-06-08 14:57:05 -04:00
Denis Kasak b90f9ee7d3 Fix typo in docstring (repeated word). 2021-06-04 22:24:15 +00:00
Denis Kasak 6ed8d687e8 Document olm_create_inbound_session_from properly.
The old docstring was the same as olm_create_inbound_session and didn't
explain the difference between them.
2021-06-04 22:24:15 +00:00
Denis Kasak 3e6592e445 Compile ASAN and MSAN versions of fuzzer harnesses too. 2021-06-02 14:02:19 +02:00
Denis Kasak 56df2613f3 Switch to afl-clang-fast(++).
This type of instrumentation is much faster (several times over) and
supports much more features than afl-gcc/afl-g++, though it requires
a LLVM/clang installation.
2021-06-02 14:02:19 +02:00
Hubert Chathi 64afab9364 prepare for release 2021-06-01 13:44:45 -04:00
Benoit Marty 995def932e Fix issue with Jitpack build 2021-05-28 18:12:50 +02:00
Hubert Chathi d856c441b6 use Python 3 2021-05-24 10:32:57 -04:00
Hubert Chathi 22bc1155ed prepare for release 2021-05-24 10:29:24 -04:00
Hubert Chathi 891a5f22c8 fix path 2021-05-24 10:27:28 -04:00
Denis Kasak ccc0d122ee olm_pk_decrypt: Ensure inputs are of correct length. 2021-05-24 15:50:14 +02:00
Denis Kasak 2f35e0bc61 olm_sas_set_their_key: Fail early on invalid base64. 2021-05-24 15:50:14 +02:00
Denis Kasak e82f2601b0 Fail decoding base64 of invalid length.
olm::decode_base64 now returns the length of the raw decoded data on
success. When given input with an invalid base64 length, it fails early
(before decoding any input) and returns -1.

This also makes the C function _olm_decode_base64 an actual binding of
olm::decode_base64 instead of a wrapper with slightly different
behaviour.
2021-05-24 15:50:14 +02:00
Denis Kasak a5efc08ef3 olm: Also initialize all fields when decoding Olm messages.
As a precaution.
2021-05-11 13:32:23 +02:00
Denis Kasak c325db02fc megolm: Fix use of uninitialized value in group message decoding.
_olm_decode_group_message should initialize all fields of the results
struct before returning. This is because its caller
_decrypt_max_plaintext_length relies on it having initialized these
fields.

Luckily, this only allows one to subvert the version check in
_decrypt_max_plaintext_length, but not the following check that the
ciphertext field is non-null because that field *is* initialized.
2021-05-11 13:23:19 +02:00
Denis Kasak 0a7b6da9a0 Slightly refactor/comment the harness for clarity. 2021-05-10 21:04:44 +00:00
Denis Kasak 8d1cfd207a Fix a fuzzing harness double free when input is of size 0.
Consider the case when the input is size 0. In this case, `count` and
`buffer_pos` will be 0 as well. The `realloc` call in the `count == 0`
branch will then effectively become a free.

However, `realloc` can sometimes return `NULL` when a 0 is passed for
the size. The current code assumes that this only happens on a memory
allocation error and breaks out of the loop. This then becomes a double
free because the buffer is freed a second time, causing an abort.

The intent of the `realloc` is probably to downsize the buffer to fit
the data exactly in order to make incorrect memory access more obvious.
This commit skips this downsizing if the size of the input data is 0.
2021-05-10 21:04:44 +00:00
Arun Babu Neelicattu 15f65283c7 make: Replace deprecated emcc configuration
EXTRA_EXPORTED_RUNTIME_METHODS is deprecated. Replace with
EXPORTED_RUNTIME_METHODS.
2021-05-10 20:40:42 +00:00
Arun Babu Neelicattu 0684eb4564 ci: add initial build pipeline 2021-05-10 20:40:42 +00:00
Arun Babu Neelicattu b0a05976ea python: remove tox basepython configuration 2021-05-10 20:40:42 +00:00
Hubert Chathi 18ad6cb067 Merge branch 'fix-ncc-audit-url' into 'master'
Fix URL to the NCC Group audit.

See merge request matrix-org/olm!22
2021-05-04 21:58:35 +00:00
Hubert Chathi d7c3971f9a update release instructions 2021-05-04 17:54:05 -04:00
Denis Kasak c95677611c Fix URL to the NCC Group audit.
The original URL is now redirecting to a generic listing page and there
are no links to the actual Olm audit paper there.
2021-05-04 15:09:29 +02:00
Lukas Lihotzki 7f53dedca6 Declare olm_sas_calculate_mac_fixed_base64 in header
Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
2021-04-27 16:18:33 -04:00
Hubert Chathi 3b3f2c71dc Merge branch 'bma/upgrade_gradle' into 'master'
Update gradle wrapper and build tools

See merge request matrix-org/olm!20
2021-04-16 20:17:51 +00:00
Benoit Marty f1d8efd821 Simplify assertions using suggestion from IDE 2021-04-16 21:57:57 +02:00
Benoit Marty 1694f15ffb Fix test compilation and run test with success
Using command `./gradlew connectedAndroidTest` on an API 21 emulator
2021-04-16 21:50:13 +02:00
Benoit Marty 4d2522a65c Update gradle wrapper and build tools
BuildConfig.VERSION_NAME is not available anymore when building library
Also replace JCenter by MavenCentral
2021-04-16 21:08:55 +02:00
Hubert Chathi dbbf467075 Merge branch 'manu/swift_package_manager' into 'master'
Xcode: Add support of Swift Package Manager

See merge request matrix-org/olm!19
2021-04-06 18:22:51 +00:00
manuroe 26bd2fc35d Swift package: Update instructions 2021-04-06 17:18:50 +02:00
manuroe 09fbb9e966 Xcode: Add support of Swift Package Manager
Made by Johennes at https://github.com/matrix-org/olm/issues/51#issuecomment-809128833
2021-04-02 19:16:11 +02:00
Hubert Chathi f16377822f Add LibreJS license tag 2021-03-31 16:11:41 -04:00
Matthew Hodgson 09384b4d45 spell ephemeral correctly... 2021-03-18 01:29:23 +00:00
Hubert Chathi bcb89bcc24 add Common Lisp bindings 2021-03-02 16:13:39 -05:00
Hubert Chathi 3745ea57bb bump version number and add changelog 2021-02-22 17:06:13 -05:00
Hubert Chathi 0bb0f85e18 don't use variables that haven't been set yet 2021-02-22 16:54:35 -05:00
Hubert Chathi 21ba95ade5 create and install a pkg-config file on Unix-like systems 2021-02-22 16:54:26 -05:00