Commit Graph

64 Commits

Author SHA1 Message Date
iphydf
50f1b30fa9
test: Add fuzz tests to the coverage run.
So we don't need to write so many edge case tests ourselves for things
like parsers, which really don't need those manual tests, as long as we
can check for some properties like "can output the parsed data and it'll
be the same as the input".
2024-01-12 12:33:41 +00:00
iphydf
afc38f2458
test: Add more unit tests for add_to_list. 2024-01-10 02:58:13 +00:00
iphydf
05ce5c1ab9
test: Add "infer" CI check to github, remove from circle.
This now uses our own built image with the current master of infer.
2024-01-09 10:59:53 +00:00
iphydf
6a90ddfe4e
cleanup: Run clang-tidy on headers, as well. 2023-12-27 02:37:39 +00:00
iphydf
fad6e4e173
cleanup: Make all .c files include the headers they need. 2023-12-27 01:21:47 +00:00
iphydf
ef4897a898
cleanup: Upgrade to clang-tidy-17 and fix some warnings. 2023-12-27 01:05:47 +00:00
iphydf
b7f9367f6f
test: Upgrade cppcheck, fix some warnings.
Also started teaching it about toxcore's alloc/dealloc functions in
hopes of it catching some errors (it doesn't seem to be very good at
this, but maybe better than nothing?).
2023-12-27 00:00:10 +00:00
Maxim Biro
63fb2941ca
Clarify disabling of static assert checks 2023-12-05 06:56:27 -05:00
iphydf
7155f7f60e
test: Add an s390x build (on alpine) for CI.
It doesn't work at all, because we're missing something in the net code
to do with endian conversions. I haven't investigated, yet, but at least
now we have a failing test that can be investigated.

Also moved to cmake 3.5 at minimum. CMake will stop supporting lower
versions than that, soon.

Also moved to C11 from C99 to get `static_assert`.

Also made a network ERROR into a WARNING. It triggers on FreeBSD.
2023-11-22 18:29:26 +00:00
iphydf
0cef46ee91
cleanup: Fix a few more clang-tidy warnings. 2023-09-07 07:49:47 +00:00
iphydf
0c5b918e9f
cleanup: Fix a few more clang-tidy warnings. 2023-09-07 07:06:34 +00:00
iphydf
4d3c97f49d
cleanup: Enforce stricter identifier naming using clang-tidy. 2023-08-31 13:37:16 +00:00
jfreegman
0a277b52ea
Merge the remainder of the new groupchats implementation
Commit history: https://github.com/jfreegman/toxcore/tree/ngc_jf
Spec: https://toktok.ltd/spec.html#dht-group-chats
2022-09-22 11:16:08 -04:00
sudden6
008d9c89ce
test: disable cppcheck rules that trigger false positives 2022-05-25 21:00:15 +02:00
sudden6
80c3a5dbb7
test: remove outdated cppcheck option 2022-05-25 20:43:00 +02:00
iphydf
7205db72e4
cleanup: Remove check_recursion, since tokstyle checks this now.
And tokstyle is better at it, covering not just direct recursion, but
also (most possible instances of) recursion through function pointers.
2022-05-24 21:35:16 +02:00
iphydf
ddda605509
fix: Don't crash if RNG init failed.
`system_random()` can fail and return NULL, which should be handled by
toxencryptsave functions.

Also synced function comments between .h and .c file for toxencryptsave.
2022-04-03 20:46:44 +00:00
iphydf
e4d1958ffa
refactor: Allow NULL logger; make it no-op in NDEBUG. 2022-04-03 18:29:22 +00:00
zugz (tox)
e49a477a84
feat: add forwarding and announce request handling
This is the "server-side" part of the new friend finding system,
allowing DHT nodes to store small amounts of data and permit searching
for it. A forwarding (proxying) mechanism allows this to be used by TCP
clients, and deals with non-transitivity in the network.
2022-04-03 00:00:08 +00:00
iphydf
660e346fce
cleanup: Disallow stack frames of over 9000 bytes.
This only happens in tests, which are easy to fix. Inside toxcore we
should actually be more stringent, but for now this helps already.
2022-04-01 13:57:16 +00:00
iphydf
e04484efae
cleanup: Remove unused random_testing program.
Fuzzers do a better job of this.
2022-04-01 09:20:04 +00:00
jfreegman
015305a088
Merge moderation portion of new groupchats codebase 2022-03-30 20:09:50 -04:00
iphydf
ee154da4a9
refactor: Use cmp instead of msgpack-c for events packing.
This library is better in every way.
2022-03-26 23:57:15 +00:00
iphydf
1928704065
test: Add fuzzer tests to the bazel build. 2022-03-25 18:48:41 +00:00
iphydf
88ae190aca
cleanup: Split the huge TCP client packet handler.
Also enable cppcheck in both C and C++ mode.
2022-03-19 11:06:50 +00:00
iphydf
2cc8dafd4c
cleanup: Remove redundant Messenger and DHT tests.
These don't test anything that isn't covered by higher level tox tests.
These are also not unit tests and have never found any bug that wasn't
also caught by other tests. This makes them a pure maintenance burden.
2022-03-03 21:17:03 +00:00
iphydf
093927ba4f
test: Add mallocfail and proxy test to our coverage runs. 2022-02-25 01:55:28 +00:00
iphydf
e7bc611dac
cleanup: Enable most cppcheck warnings as errors.
Cleaned up some of the warnings it gives. Disabled the ones that are
less useful for us at this time.
2022-02-21 17:17:36 +00:00
iphydf
6a6bc029de
cleanup: Remove unused execution trace library. 2022-02-19 11:44:13 +00:00
iphydf
933c6b7517
refactor: Compare pointers in if conditions to nullptr.
Don't use implicit ptr-to-bool conversion.
2022-02-17 19:55:29 +00:00
iphydf
33588c1aad
cleanup: Don't use VLAs for huge allocations.
One of these was creating a single 262144 byte stack frame. We now have
a way to check and limit the allocation size of a VLA. The `Cmp_Data`
ones were also fairly large. Now, no allocation is larger than 2KiB
(though rtp.c allocates close to that much).
2022-02-11 03:05:30 +00:00
iphydf
10f86f6c00
cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
iphydf
5a3a0b6453
cleanup: Add nonnull annotations to function definitions.
These help static analysis and ubsan. We should eventually have all
functions annotated like this with a cimple check to make sure every
pointer has an explicit nullability annotation. The `nullable`
annotation does nothing in GCC, but will be used by cimple to validate
that every parameter has defined nullability.
2022-02-08 17:57:47 +00:00
iphydf
0a2190f28c
feat: Add binary packing functions for tox events. 2022-02-07 02:43:24 +00:00
iphydf
de4af4c270
feat: Add async event handling (callbacks) code.
Instead of synchronously handling events as they happen in
`tox_iterate`, this first collects all events in a structure and then
lets the client process them. This allows clients to process events in
parallel, since the data structure returned is mostly immutable.

This also makes toxcore compatible with languages that don't (easily)
support callbacks from C into the non-C language.

If we remove the callbacks, this allows us to add fields to the events
without breaking the API.
2022-02-06 17:28:28 +00:00
iphydf
1859d0f44a
cleanup: Ensure we limit the system headers included in .h files.
Most system headers contain functions (e.g. `memcpy` in `string.h`)
which aren't needed in our own header files. For the most part, our own
headers should only include types needed to declare our own types and
functions. We now enforce this so we think twice about which headers we
really need in the .h files.
2022-02-04 20:54:37 +00:00
iphydf
014cc42249
chore: Make run-infer script use docker.
So people can run it locally more easily.
2022-02-03 20:11:16 +00:00
Maxim Biro
b2ea0e5c76
Add programs for creating savedata & bootstrap keys 2022-01-27 16:31:07 -05:00
iphydf
7f94e411a9
chore: Add cpplint to the CI. 2022-01-17 23:42:38 +00:00
iphydf
5fbcbb6c83
cleanup: Remove uses of strcpy and sprintf.
Use of `strcpy` in these particular cases was safe, but it's hard to
tell and also useless. `strcpy` would effectively need to do another
`strlen` which we already did.

Also removed sprintf, which was also safe in this case but it's easier to
be "obviously safe", especially for static analysers.
2022-01-17 18:25:40 +00:00
iphydf
8d19757f8e
chore: Add mypy Python type check.
Also fix the types in all Python files.
2022-01-14 19:55:37 +00:00
iphydf
d23222c92f
chore: Run static analysers in multiple variants.
Currently: 1) libsodium and 2) nacl.

Note that the "nacl" variant is actually libsodium. We just want to make
sure the static analysers see the `VANILLA_NACL` code paths.
2022-01-14 10:45:11 +00:00
iphydf
cfb0aa8f25
cleanup: Remove extra parens around function arguments. 2022-01-12 07:02:29 +00:00
sudden6
e04b890817
add scripts to run the fuzzing process
This adds scripts and Dockerfiles to run the fuzzing process standalone
or with OSS-Fuzz/ClusterFuzzLite integrations.
2022-01-10 21:05:51 +01:00
iphydf
74bf0fc2c8
chore: Disable -Wmissing-braces.
This flag isn't helpful for the most common case of aggregate
initialisation, namely `{0}`. We don't want to be writing `{{{0}}}` with
some brittle number of braces.
2021-12-21 12:04:04 +00:00
sudden6
b14d9328b4
update build scripts 2021-12-17 20:34:13 +01:00
iphydf
2ba2cbd8e9
chore: Fix gen-file.sh: it wasn't globbing properly.
Also fix crypto_core_test.cc to comply with the stack frame limit.
2021-12-14 21:26:52 +00:00
iphydf
cd83c9282c
chore: Add .cc files to the static analysis. 2021-12-14 19:33:18 +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
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