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:
parent
60446b8d5f
commit
f6b10fbe4a
@ -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",
|
||||
]
|
||||
}
|
||||
|
||||
25
test/fuzzers/url_decode_fuzzer.cc
Normal file
25
test/fuzzers/url_decode_fuzzer.cc
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user