Commit Graph

4933 Commits

Author SHA1 Message Date
iphydf
74bc87f277
test: Make ERROR logging fatal in tests.
This doesn't currently work, because we get a lot of errors during tests.
This should not happen. Either those errors are warnings, or something is
wrong with either the code or the test.
2021-12-14 13:00:25 +00:00
iphydf
5c53e6a30f
chore: Add autotools build; exempt crypto_pwhash from tokstyle. 2021-12-13 18:47:45 +00:00
iphydf
fd32c87707
cleanup: Don't include "config.h" unless needed.
Currently only `crypto_core_mem.c` needs this. We should try not to
depend on configure'd values. Also note: config.h is only created and
used in the autotools build. In CMake, we pass `-D` flags directly.
2021-12-12 22:18:38 +00:00
jfreegman
d66adbecac
Address some unused return values
We now either log errors or properly propagate them. In the case of
ping_send_request we make the function return void because it doesn't
seem to matter whether or not it succeeds.
2021-12-11 10:46:50 -05:00
sudden6
891fe60ea2
extend ToxAV API to support different threads for audio and video
This allows for prioritizing audio over video transcoding and improves
performance when multiple CPU cores are available.
2021-12-11 10:43:47 +01:00
sudden6
a80a29163c
clarify purpose of variable 2021-12-10 23:10:21 +01:00
jfreegman
346b9f17ba
use crypto_memzero to wipe secret keys when no longer in use 2021-12-10 16:31:34 -05:00
jfreegman
612c3b2b47
Fix off-by-one error caused by integer division without proper cast 2021-12-10 16:24:23 -05:00
sudden6
6654c1794a
cleanup friend loading
The assert was removed, because it triggers as soon as the padding bytes
in the struct Saved_Friend are non zero. The Tox specification doesn't
say anything about the value of these bytes, so we should just ignore
them.
2021-12-10 20:55:56 +00:00
iphydf
b3c757e9d8
chore: Use an incrementing version number for coverity scans.
Otherwise, no analysis will happen.
2021-12-10 16:53:57 +00:00
iphydf
e30266f1ce
fix: Fixed uninitialised value copy.
In the "no proxy" case, the `IP_Port` in the default "no proxy" default
proxy info is uninitialised. It is never used for any decisions in the
code, but it is copied in memory, making it a potential crash on systems
with trap representations of ints.
2021-12-10 15:29:17 +00:00
iphydf
30c939e4ab
cleanup: Fix some clang-tidy warnings and make them errors.
The android warnings are disabled now because they suggest using
linux-only extensions of libc. Useful for android indeed, but we're
targeting non-android and non-linux systems as well.
2021-12-10 15:21:27 +00:00
iphydf
d5fefc927e
cleanup: Require {} around all switch case label statements.
Except for single return-with-value statements.
2021-12-10 14:20:13 +00:00
iphydf
31a61f9b37
chore: Add missing -fi flag to autoreconf in coverity scan. 2021-12-10 13:02:08 +00:00
jfreegman
55317b5810
Put fatal errors where API return values should be impossible 2021-12-09 16:00:55 -05:00
iphydf
fd91bbdd7b
test: Add a simple test for ip_ntoa.
Just to demonstrate that it will never exceed its input buffer.
2021-12-09 20:51:15 +00:00
Maxim Biro
4e8e556a93
Fix previous refactor
Includes should be sorted alphabetically and null-terminating is
unnecessary with snprintf.
2021-12-09 13:23:06 -05:00
iphydf
e174e68198
chore: Add missing sudo to coverity apt-get calls. 2021-12-09 15:33:15 +00:00
iphydf
716cc2f2ee
chore: Add clang-tidy review github workflow. 2021-12-09 15:29:31 +00:00
iphydf
e4ad0c833c
cleanup: Enforce for loop consistency.
All for-loops must have an init-decl, a condition, and an increment
statement. Any loop that doesn't have one of these should be a while
loop (only 2 of these exist in toxav, none in toxcore).
2021-12-09 14:53:00 +00:00
iphydf
fa359091c7
chore: Minor cleanups of warnings given by cppcheck. 2021-12-09 11:08:03 +00:00
iphydf
044a93081a
chore: Add workflow for running coverity scan. 2021-12-08 00:23:11 +00:00
iphydf
2bc83a4b51
cleanup: Use static_assert instead of preprocessor #error.
`ccompat.h` ensures that if it doesn't exist, then `static_assert` has no
effect.
2021-12-07 18:42:29 +00:00
jfreegman
edf9d66717
Add logger to onion and onion announce objects
This will be used in the future
2021-12-07 13:01:15 -05:00
iphydf
51a2acd1f5
cleanup: Avoid endian-specific code in crypto_core. 2021-12-07 17:23:09 +00:00
iphydf
cdc0286050
cleanup: Minor fixes in test code.
* Buffer overrun in auto test.
* Resource leak in AFL test code.
2021-12-07 17:13:58 +00:00
jfreegman
01ea27085f
Refactor kill_nonused_tcp()
This makes the code a little more flat and readable. We also change the
logic so that we can kill the necessary number of unused relays immediately
rather than having to collect them and remove them in a separate loop
2021-12-07 11:50:56 -05:00
iphydf
1ce6aab5da
cleanup: Ensure that error codes are always initialised.
In this case, there was no way it would not be, but a code change down
the stack could cause a variable to become uninitialised. This avoids a
gcc warning and is more locally-correct.
2021-12-07 15:12:42 +00:00
iphydf
101e235131
cleanup: Fix last instance of -Wcast-align and enable the warning.
We used to have lots of these in the code, but now that all the endian
stuff is no longer dependent on host byte order, we can re-enable the
warning flag and catch any future violations.
2021-12-07 14:51:31 +00:00
iphydf
2db6599be5
test: Add some simple tests for list.c.
These are pretty useless, but I'm adding the list_test.cc file for future
better tests to be written in.
2021-12-07 10:32:45 +00:00
Robin Linden
713ce6108c
Improve Tox creation logging in save_load test 2021-12-06 23:28:53 +01:00
Robin Linden
4348b96a5b
Release 0.2.13 2021-12-06 23:28:52 +01:00
jfreegman
ce268c2f82
Add some missing null checks 2021-12-06 16:57:07 -05:00
iphydf
d930ecca4c
chore: Run infer static analyser on circle ci builds.
Also running some other analysis that we used to have on Travis.
2021-12-06 20:25:50 +00:00
iphydf
af1848ed13
chore: Use toktok-stack docker image with built third_party.
This should cut down the build time a bit by downloading the binaries
built for `//third_party/...`.
2021-12-05 19:21:57 +00:00
sudden6
0320e2eb8e
fix missing braces in computed macro value
Using this value in any computation might not work as expected.
2021-12-05 14:20:04 +01:00
sudden6
1b02bad368
fix possible stack overflow
CRYPTO_SIZE is used in a subtraction as second argument and instead of
subtracting then intended value only '1' is subtracted due to operator
precedence rules and missing braces.
2021-12-05 14:20:00 +01:00
zugz (tox)
f12347dfec
Fix buffer over-read when a peer leaves a conference
Fixes 1598 -- thanks to peirick for reporting the bug.
2021-12-01 20:31:50 +00:00
iphydf
57b0651ffd
test: Add some unit tests for important internal DHT functions.
We definitely need more of this kind of test so refactorings don't
accidentally break things in ways that happen to still work in auto
tests.
2021-12-01 14:08:37 +00:00
sudden6
fd73f3eeb6
add logging when connection limits file transfer speed 2021-11-30 15:55:00 +01:00
sudden6
286cc44f54
rewrite filetransfer logic in Messenger.c
Makes the logic easier to follow and removes suspicious case.
2021-11-30 15:54:58 +01:00
sudden6
10ddf8097c
rewrite loop for better understanding 2021-11-30 15:53:31 +01:00
sudden6
825d457073
simplify do_all_filetransfers
This should not change any behaviour of this function.
2021-11-30 15:52:27 +01:00
zugz (tox)
01c3869bd0
Add instructions for building unit tests to INSTALL.md 2021-11-30 14:10:16 +00:00
sudden6
0c320462d7
perf: reduce calling into Mono_Time in DHT
Mono_Time needs to acquire a lock each time one of its functions are
used. This becomes very costly in the DHT code where timeouts for all
connected nodes are recalculated. Improve this by caching the timestamp
at the begin of a do_dht() iteration.
2021-11-29 19:02:17 +01:00
jfreegman
8b725c1ecc
Fix some friend connection issues
- Properly handle crypto_connection_status() failure
- Remove CONNECTION_UNKNOWN and restructure surrounding logic so that
  the API no longer reports erroneous friend connection statuses
2021-11-27 19:27:55 -05:00
jfreegman
c0a0a8204c
Fix bug causing API to report wrong self connection status 2021-11-27 18:43:35 -05:00
iphydf
99d873b985
chore: Enable cimple tests on cirrus build.
This ensures that we don't break Cimple compatibility despite Travis
being gone (which used to test this).
2021-11-27 02:56:17 +00:00
jfreegman
b66165977e
fix issue with save_load autotest
The test explicitly wanted a UDP connection when a TCP connection would suffice. This
was a remnant of back when the test was part of a multi-purpose autotest that
didn't attempt to connect to TCP relays and needed a UDP connection specifically.
2021-11-25 15:32:29 -05:00
iphydf
1700334c3b
chore: Upgrade to toktok-stack:0.0.11. 2021-11-25 18:32:50 +00:00