Basic fuzzing of rtc::s_url_decode.

rtc::s_url_decode internally calls transform on rtc::url_decode which operates
on raw char buffers. This is used in some core parts of ice server parsing so
it makes sense to add at least a basic fuzzer here. Corpus generation will be
tailored in a future CL.

Bug: webrtc:10117
Change-Id: If1685601c746c4a9f88c2a8d396eeb3f1b1688d4
Reviewed-on: https://webrtc-review.googlesource.com/c/113835
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25980}
This commit is contained in:
Benjamin Wright 2018-12-11 16:35:04 -08:00 committed by Commit Bot
parent 60446b8d5f
commit f6b10fbe4a
2 changed files with 34 additions and 0 deletions

View File

@ -544,3 +544,12 @@ webrtc_fuzzer_test("frame_buffer2_fuzzer") {
"../../system_wrappers:system_wrappers",
]
}
webrtc_fuzzer_test("url_decode_fuzzer") {
sources = [
"url_decode_fuzzer.cc",
]
deps = [
"../../rtc_base:rtc_base_approved",
]
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2018 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 "rtc_base/stringencode.h"
namespace webrtc {
// Fuzz s_url_decode which is used in ice server parsing.
void FuzzOneInput(const uint8_t* data, size_t size) {
std::string url(reinterpret_cast<const char*>(data), size);
rtc::s_url_decode(url);
}
} // namespace webrtc