Commit 1bbd7202 authored by Jonathan Metzman's avatar Jonathan Metzman Committed by Commit Bot

[libFuzzer][Windows] Fix template_url_parser_fuzzer build

Use uniform_int_distribution in a way that Windows allows.

Bug: 891867
Change-Id: I7a9cf5c213ddfc8ca83efa29757674eea54a1c44
Reviewed-on: https://chromium-review.googlesource.com/c/1260162
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Reviewed-by: default avatarMartin Barbella <mbarbella@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596424}
parent 3231c2fd
......@@ -21,12 +21,15 @@ class PseudoRandomFilter : public TemplateURLParser::ParameterFilter {
~PseudoRandomFilter() override = default;
bool KeepParameter(const std::string&, const std::string&) override {
return pool_(generator_);
// Return true 254/255 times, ie: as if pool_ only returned uint8_t.
return pool_(generator_) % (UINT8_MAX + 1);
}
private:
std::mt19937 generator_;
std::uniform_int_distribution<uint8_t> pool_;
// Use a uint16_t here instead of uint8_t because uniform_int_distribution
// does not support 8 bit types on Windows.
std::uniform_int_distribution<uint16_t> pool_;
};
struct FuzzerFixedParams {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment