Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fuzz] Fixed crashing fuzz test in Http Health Check Fuzz #13219

Merged
merged 3 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/common/upstream/health_check_corpus/ConnectionClose

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/common/upstream/health_check_corpus/Degraded

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/common/upstream/health_check_corpus/LargeNanos

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/common/upstream/health_check_corpus/Success

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/common/upstream/health_check_corpus/ZeroRetryInterval

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/common/upstream/health_check_corpus/crash_1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/common/upstream/health_check_corpus/crash_3

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/common/upstream/health_check_corpus/crash_4

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/common/upstream/health_check_corpus/crash_5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions test/common/upstream/health_check_fuzz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void HealthCheckFuzz::initializeAndReplay(test::common::upstream::HealthCheckTes
replay(input);
}

void HealthCheckFuzz::respondHttp(const test::fuzz::Headers& headers, absl::string_view status) {

void HealthCheckFuzz::respondHttp(const test::fuzz::Headers& headers, uint64_t status) {
// Timeout timer needs to be explicitly enabled, usually by onIntervalBase() (Callback on interval
// timer).
if (!test_sessions_[0]->timeout_timer_->enabled_) {
Expand Down
3 changes: 2 additions & 1 deletion test/common/upstream/health_check_fuzz.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once

#include "test/common/upstream/health_check_fuzz.pb.validate.h"
#include "test/common/upstream/health_checker_impl_test_utils.h"
#include "test/fuzz/common.pb.h"
Expand All @@ -22,7 +23,7 @@ class HealthCheckFuzz
Type type_;

private:
void respondHttp(const test::fuzz::Headers& headers, absl::string_view status);
void respondHttp(const test::fuzz::Headers& headers, uint64_t status);
void triggerIntervalTimer(bool expect_client_create);
void triggerTimeoutTimer(bool last_action);
void allocHealthCheckerFromProto(const envoy::config::core::v3::HealthCheck& config);
Expand Down
3 changes: 1 addition & 2 deletions test/common/upstream/health_check_fuzz.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import "google/protobuf/empty.proto";

message HttpRespond { //TODO: Split this across headers, body, and trailers?
test.fuzz.Headers headers = 1;
//https://github.com/nodejs/http-parser/blob/master/http_parser.c#L852
string status = 2 [(validate.rules).string = {pattern: "[0-9]+$*", min_len: 1}];
uint64 status = 2;
asraa marked this conversation as resolved.
Show resolved Hide resolved
}

message Respond {
Expand Down