Add fuzzer for TURN unwrap.

This is called on received network packets if dump_rtp_packets_ is on.

NOTRY=true

Review-Url: https://codereview.webrtc.org/2126463002
Cr-Commit-Position: refs/heads/master@{#13394}
This commit is contained in:
katrielc 2016-07-06 05:59:23 -07:00 committed by Commit bot
parent 0c6f0f6d96
commit 262ba77d78
2 changed files with 38 additions and 1 deletions

View File

@ -7,8 +7,9 @@
# be found in the AUTHORS file in the root of the source tree.
import("//build/config/features.gni")
import("//testing/test.gni")
import("//build_overrides/webrtc.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
static_library("webrtc_fuzzer_main") {
public_configs = [ "../..:common_inherited_config" ]
@ -175,3 +176,17 @@ webrtc_fuzzer_test("audio_decoder_opus_redundant_fuzzer") {
"../../modules/audio_coding:webrtc_opus",
]
}
# TODO(katrielc) Enable in Chromium when CL 2022833002 lands.
# Although the dependency on media compiles in standalone, it is
# flagged by gn check, so breaks when rolled into Chromium.
if (!build_with_chromium) {
webrtc_fuzzer_test("turn_unwrap_fuzzer") {
sources = [
"turn_unwrap_fuzzer.cc",
]
deps = [
"../../media:media",
]
}
}

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <stddef.h>
#include <stdint.h>
#include "webrtc/media/base/turnutils.h"
namespace webrtc {
void FuzzOneInput(const uint8_t* data, size_t size) {
size_t content_position;
size_t content_size;
cricket::UnwrapTurnPacket(data, size, &content_position, &content_size);
}
} // namespace webrtc