提交 84dcd22a authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

fuzzer: This is a non stop

上级 3f7c7f19
...@@ -61,10 +61,10 @@ Executes the `worker/out/mediasoup-worker-fuzzer` binary. ...@@ -61,10 +61,10 @@ Executes the `worker/out/mediasoup-worker-fuzzer` binary.
* Set `FUZZER_CORPUS_DIRS` environment variable to set Fuzzer corpus directories. * Set `FUZZER_CORPUS_DIRS` environment variable to set Fuzzer corpus directories.
* Set `LSAN_OPTIONS` environment variable for LSAN options. * Set `LSAN_OPTIONS` environment variable for LSAN options.
Regardless value of `FUZZER_CORPUS_DIRS`, the first corpus directory will always be `./worker/fuzzer/new-corpus`, so new generated test inputs will be written there. Regardless value of `FUZZER_CORPUS_DIRS`, the first corpus directory will always be `./worker/fuzzer/new-corpus` so new generated test inputs will be written there, and crash reports will be written in the `worker/fuzzer/reports` directory (hardcoded `-artifact_prefix=./fuzzer/reports/` fuzzer option).
```bash ```bash
$ FUZZER_CORPUS_DIRS="fuzzer/corpora/rtp-corpus" make fuzzer-run $ FUZZER_OPTIONS="-max_len=1800" FUZZER_CORPUS_DIRS="fuzzer/corpora/rtp-corpus" make fuzzer-run
``` ```
...@@ -84,7 +84,7 @@ $ ./scripts/get-dep.sh clang-fuzzer ...@@ -84,7 +84,7 @@ $ ./scripts/get-dep.sh clang-fuzzer
Runs a container of the Docker image created with `fuzzer-docker-build` and executes `worker/out/mediasoup-worker-fuzzer` binary. Runs a container of the Docker image created with `fuzzer-docker-build` and executes `worker/out/mediasoup-worker-fuzzer` binary.
Some environment variables than `fuzzer-run` are supported. However: Some environment variables than `fuzzer-run` are supported (with same constraints). However:
* `FUZZER_CORPUS_DIRS` must be relative to the `worker` directory. * `FUZZER_CORPUS_DIRS` must be relative to the `worker` directory.
......
...@@ -43,6 +43,6 @@ CMD \ ...@@ -43,6 +43,6 @@ CMD \
set -x \ set -x \
&& cd /mediasoup/worker \ && cd /mediasoup/worker \
&& ./out/Release/mediasoup-worker-fuzzer \ && ./out/Release/mediasoup-worker-fuzzer \
${FUZZER_OPTIONS} \ ${FUZZER_OPTIONS} -artifact_prefix=/reports/ \
/new-corpus \ /new-corpus \
${FUZZER_CORPUS_DIRS} ${FUZZER_CORPUS_DIRS}
...@@ -46,7 +46,7 @@ fuzzer: ...@@ -46,7 +46,7 @@ fuzzer:
fuzzer-run: fuzzer-run:
./out/Release/mediasoup-worker-fuzzer \ ./out/Release/mediasoup-worker-fuzzer \
${FUZZER_OPTIONS} \ ${FUZZER_OPTIONS} -artifact_prefix=./fuzzer/reports/ \
./fuzzer/new-corpus \ ./fuzzer/new-corpus \
${FUZZER_CORPUS_DIRS} ${FUZZER_CORPUS_DIRS}
...@@ -59,15 +59,16 @@ fuzzer-fake: ...@@ -59,15 +59,16 @@ fuzzer-fake:
fuzzer-docker-build: fuzzer-docker-build:
ifeq ($(DOCKER_NO_CACHE),true) ifeq ($(DOCKER_NO_CACHE),true)
docker build -f fuzzer/Dockerfile --no-cache --tag mediasoup/fuzzer:latest . docker build -f Dockerfile.fuzzer --no-cache --tag mediasoup/fuzzer:latest .
else else
docker build -f fuzzer/Dockerfile --tag mediasoup/fuzzer:latest . docker build -f Dockerfile.fuzzer --tag mediasoup/fuzzer:latest .
endif endif
fuzzer-docker-run: fuzzer-docker-run:
docker run \ docker run \
--init --name=mediasoupFuzzer -it --rm \ --init --name=mediasoupFuzzer -it --rm \
-v $(shell pwd)/fuzzer/new-corpus:/new-corpus \ -v $(shell pwd)/fuzzer/new-corpus:/new-corpus \
-v $(shell pwd)/fuzzer/reports:/reports \
-e FUZZER_OPTIONS \ -e FUZZER_OPTIONS \
-e FUZZER_CORPUS_DIRS \ -e FUZZER_CORPUS_DIRS \
-e LSAN_OPTIONS \ -e LSAN_OPTIONS \
......
...@@ -28,7 +28,7 @@ public: ...@@ -28,7 +28,7 @@ public:
// Struct holding the configuration. // Struct holding the configuration.
struct Configuration struct Configuration
{ {
LogLevel logLevel{ LogLevel::LOG_DEBUG }; LogLevel logLevel{ LogLevel::LOG_DEBUG }; // TODO: Should be LOG_ERROR IMHO.
struct LogTags logTags; struct LogTags logTags;
std::string rtcIPv4; std::string rtcIPv4;
std::string rtcIPv6; std::string rtcIPv6;
......
#define MS_CLASS "RTC::RTCP::ReceiverReport" #define MS_CLASS "RTC::RTCP::ReceiverReport"
#define MS_LOG_DEV // #define MS_LOG_DEV
#include "RTC/RTCP/ReceiverReport.hpp" #include "RTC/RTCP/ReceiverReport.hpp"
#include "Logger.hpp" #include "Logger.hpp"
...@@ -71,6 +71,14 @@ namespace RTC ...@@ -71,6 +71,14 @@ namespace RTC
// Get the header. // Get the header.
auto* header = const_cast<CommonHeader*>(reinterpret_cast<const CommonHeader*>(data)); auto* header = const_cast<CommonHeader*>(reinterpret_cast<const CommonHeader*>(data));
if (sizeof(CommonHeader) > len)
{
MS_WARN_TAG(rtcp, "not enough space for receiver report packet, packet discarded");
return nullptr;
}
std::unique_ptr<ReceiverReportPacket> packet(new ReceiverReportPacket()); std::unique_ptr<ReceiverReportPacket> packet(new ReceiverReportPacket());
packet->SetSsrc( packet->SetSsrc(
......
#define MS_CLASS "RTC::RTCP::Sdes" #define MS_CLASS "RTC::RTCP::Sdes"
#define MS_LOG_DEV // #define MS_LOG_DEV
#include "RTC/RTCP/Sdes.hpp" #include "RTC/RTCP/Sdes.hpp"
#include "Logger.hpp" #include "Logger.hpp"
......
#define MS_CLASS "RTC::RTCP::SenderReport" #define MS_CLASS "RTC::RTCP::SenderReport"
#define MS_LOG_DEV // #define MS_LOG_DEV
#include "RTC/RTCP/SenderReport.hpp" #include "RTC/RTCP/SenderReport.hpp"
#include "Logger.hpp" #include "Logger.hpp"
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论