![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /proc/thread-self/root/usr/local/lib/node_modules/mediasoup/worker/fuzzer/src/ |
Upload File : |
#define MS_CLASS "fuzzer" #include "DepLibSRTP.hpp" #include "DepLibUV.hpp" #include "DepLibWebRTC.hpp" #include "DepOpenSSL.hpp" #include "DepUsrSCTP.hpp" #include "FuzzerUtils.hpp" #include "LogLevel.hpp" #include "Settings.hpp" #include "Utils.hpp" #include "RTC/FuzzerRtpPacket.hpp" #include "RTC/FuzzerStunPacket.hpp" #include "RTC/FuzzerTrendCalculator.hpp" #include "RTC/RTCP/FuzzerPacket.hpp" #include <cstdlib> // std::getenv() #include <iostream> #include <stddef.h> #include <stdint.h> bool fuzzStun = false; bool fuzzRtp = false; bool fuzzRtcp = false; bool fuzzUtils = false; int Init(); extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t len) { // Trick to initialize our stuff just once. static int unused = Init(); // Avoid [-Wunused-variable]. unused++; if (fuzzStun) Fuzzer::RTC::StunPacket::Fuzz(data, len); if (fuzzRtp) Fuzzer::RTC::RtpPacket::Fuzz(data, len); if (fuzzRtcp) Fuzzer::RTC::RTCP::Packet::Fuzz(data, len); if (fuzzUtils) { Fuzzer::Utils::Fuzz(data, len); Fuzzer::RTC::TrendCalculator::Fuzz(data, len); } return 0; } int Init() { LogLevel logLevel{ LogLevel::LOG_NONE }; // Get logLevel from ENV variable. if (std::getenv("MS_FUZZ_LOG_LEVEL")) { if (std::string(std::getenv("MS_FUZZ_LOG_LEVEL")) == "debug") logLevel = LogLevel::LOG_DEBUG; else if (std::string(std::getenv("MS_FUZZ_LOG_LEVEL")) == "warn") logLevel = LogLevel::LOG_WARN; else if (std::string(std::getenv("MS_FUZZ_LOG_LEVEL")) == "error") logLevel = LogLevel::LOG_ERROR; } // Select what to fuzz. if (std::getenv("MS_FUZZ_STUN") && std::string(std::getenv("MS_FUZZ_STUN")) == "1") { std::cout << "[fuzzer] STUN fuzzers enabled" << std::endl; fuzzStun = true; } if (std::getenv("MS_FUZZ_RTP") && std::string(std::getenv("MS_FUZZ_RTP")) == "1") { std::cout << "[fuzzer] RTP fuzzers enabled" << std::endl; fuzzRtp = true; } if (std::getenv("MS_FUZZ_RTCP") && std::string(std::getenv("MS_FUZZ_RTCP")) == "1") { std::cout << "[fuzzer] RTCP fuzzers enabled" << std::endl; fuzzRtcp = true; } if (std::getenv("MS_FUZZ_UTILS") && std::string(std::getenv("MS_FUZZ_UTILS")) == "1") { std::cout << "[fuzzer] Utils fuzzers enabled" << std::endl; fuzzUtils = true; } if (!fuzzUtils && !fuzzStun && !fuzzRtcp && !fuzzRtp) { std::cout << "[fuzzer] all fuzzers enabled" << std::endl; fuzzStun = true; fuzzRtp = true; fuzzRtcp = true; fuzzUtils = true; } Settings::configuration.logLevel = logLevel; // Initialize static stuff. DepLibUV::ClassInit(); DepOpenSSL::ClassInit(); DepLibSRTP::ClassInit(); DepUsrSCTP::ClassInit(); DepLibWebRTC::ClassInit(); Utils::Crypto::ClassInit(); return 0; }