Source code

Revision control

Other Tools

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 "gtest/gtest.h"
10
11
#include "FuzzingInterface.h"
12
13
extern "C" {
14
#include <csi_platform.h>
15
#include "stun_msg.h"
16
#include "stun_codec.h"
17
}
18
19
int FuzzingInitStunParser(int* argc, char*** argv) { return 0; }
20
21
static int RunStunParserFuzzing(const uint8_t* data, size_t size) {
22
nr_stun_message* req = 0;
23
24
UCHAR* mes = (UCHAR*)data;
25
26
if (!nr_stun_message_create2(&req, mes, size)) {
27
nr_stun_decode_message(req, nullptr, nullptr);
28
nr_stun_message_destroy(&req);
29
}
30
31
return 0;
32
}
33
34
MOZ_FUZZING_INTERFACE_RAW(FuzzingInitStunParser, RunStunParserFuzzing,
35
StunParser);