summaryrefslogtreecommitdiff
path: root/toxav
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2020-05-02 20:49:41 +0100
committeriphydf <iphydf@users.noreply.github.com>2020-05-02 21:47:08 +0100
commit2570ddcb17fdf5bea56c6bc1c5c2d04ba2068ee7 (patch)
tree621dd5a3953ad786650e50fdba2787009c78df95 /toxav
parente057bae563e133dbab7381ebbe1dc10f93d6eb4f (diff)
Fix errors on error paths found by oomer.
* Use-after-free because we free network before dht in one case. * Various unchecked allocs in tests (not so important). * We used to not check whether ping arrays were actually allocated in DHT. * `ping_kill` and `ping_array_kill` used to crash when passing NULL. Also: * Added an assert in all public API functions to ensure tox isn't NULL. The error message you get from that is a bit nicer than "Segmentation fault" when clients (or our tests) do things wrong. * Decreased the sleep time in iterate_all_wait from 20ms to 5ms. Everything seems to still work with 5ms, and this greatly decreases the amount of time spent per test run, making oomer run much faster.
Diffstat (limited to 'toxav')
-rw-r--r--toxav/ring_buffer_test.cc4
-rw-r--r--toxav/rtp_test.cc4
2 files changed, 4 insertions, 4 deletions
diff --git a/toxav/ring_buffer_test.cc b/toxav/ring_buffer_test.cc
index 672ee2ce..667f90e3 100644
--- a/toxav/ring_buffer_test.cc
+++ b/toxav/ring_buffer_test.cc
@@ -1,11 +1,11 @@
1#include "ring_buffer.h" 1#include "ring_buffer.h"
2 2
3#include <gtest/gtest.h>
4
3#include <algorithm> 5#include <algorithm>
4#include <cassert> 6#include <cassert>
5#include <vector> 7#include <vector>
6 8
7#include <gtest/gtest.h>
8
9namespace { 9namespace {
10 10
11template <typename T> 11template <typename T>
diff --git a/toxav/rtp_test.cc b/toxav/rtp_test.cc
index b0854142..bd94cc9c 100644
--- a/toxav/rtp_test.cc
+++ b/toxav/rtp_test.cc
@@ -1,9 +1,9 @@
1#include "rtp.h" 1#include "rtp.h"
2 2
3#include "../toxcore/crypto_core.h"
4
5#include <gtest/gtest.h> 3#include <gtest/gtest.h>
6 4
5#include "../toxcore/crypto_core.h"
6
7namespace { 7namespace {
8 8
9RTPHeader random_header() { 9RTPHeader random_header() {