Field trial fuzzer.

This simple fuzzer is intended to detect potential issues in the field trial
parsing code. Since these can be set by the browser it is better to have some
fuzzing coverage around this area.

Bug: webrtc:10395
Change-Id: I1b8b859d2107a0bc99cb7520cf0ef96f3d110547
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127121
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27087}
This commit is contained in:
Benjamin Wright
2019-03-12 10:56:05 -07:00
committed by Commit Bot
parent fa852efb73
commit ade5cb8294
5 changed files with 38 additions and 0 deletions

View File

@ -558,3 +558,13 @@ webrtc_fuzzer_test("url_decode_fuzzer") {
"../../rtc_base:rtc_base_approved",
]
}
webrtc_fuzzer_test("field_trial_fuzzer") {
sources = [
"field_trial_fuzzer.cc",
]
deps = [
"../../system_wrappers:field_trial",
]
seed_corpus = "corpora/field_trial-corpus"
}

View File

@ -0,0 +1 @@
WebRTC-DecoderDataDumpDirectory/Enabled/

View File

@ -0,0 +1 @@
WebRTC-DecoderDataDumpDirectory/Disabled/

View File

@ -0,0 +1 @@
WebRTC-DecoderDataDumpDirectory/Disabled/WebRTC-IPv6Default/Enabled/

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2019 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 <string>
#include "system_wrappers/include/field_trial.h"
namespace webrtc {
void FuzzOneInput(const uint8_t* data, size_t size) {
std::string field_trial(reinterpret_cast<const char*>(data), size);
field_trial::InitFieldTrialsFromString(field_trial.c_str());
field_trial::FindFullName(field_trial);
}
} // namespace webrtc