tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sdp_parser_libfuzz.cpp (893B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include <string>
      8 
      9 #include "FuzzingInterface.h"
     10 #include "gtest/gtest.h"
     11 #include "sdp/SipccSdpParser.h"
     12 
     13 using namespace mozilla;
     14 
     15 constinit static mozilla::UniquePtr<SdpParser::Results> sdpPtr;
     16 MOZ_RUNINIT static SipccSdpParser mParser;
     17 
     18 int FuzzingInitSdpParser(int* argc, char*** argv) { return 0; }
     19 
     20 static int RunSdpParserFuzzing(const uint8_t* data, size_t size) {
     21  std::string message(reinterpret_cast<const char*>(data), size);
     22 
     23  sdpPtr = mParser.Parse(message);
     24 
     25  return 0;
     26 }
     27 
     28 MOZ_FUZZING_INTERFACE_RAW(FuzzingInitSdpParser, RunSdpParserFuzzing, SdpParser);