aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@gmail.com>2017-04-07 08:24:26 -0700
committerGravatar GitHub <noreply@github.com>2017-04-07 08:24:26 -0700
commit55a61e43b9abe9c95a6e401239bdd02a48deb587 (patch)
treed448a1b5ab658d17d32559783693824d68061718 /test
parentb567bb43670f7f2523164fdabdea8786a7595854 (diff)
parent786c852035aac17ff8584a900c6206cc151062e8 (diff)
Merge pull request #10492 from ncteisen/error-overflow
Fix Error Overflow Bug
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-6312731374256128bin0 -> 26793 bytes
-rw-r--r--test/core/iomgr/error_test.c30
2 files changed, 28 insertions, 2 deletions
diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-6312731374256128 b/test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-6312731374256128
new file mode 100644
index 0000000000..4c6eb601ae
--- /dev/null
+++ b/test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-6312731374256128
Binary files differ
diff --git a/test/core/iomgr/error_test.c b/test/core/iomgr/error_test.c
index 5c60a4ddb8..607dbeea3e 100644
--- a/test/core/iomgr/error_test.c
+++ b/test/core/iomgr/error_test.c
@@ -182,8 +182,6 @@ static void print_error_string_reference() {
grpc_error* parent =
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Parent", children, 2);
- gpr_log(GPR_DEBUG, "%s", grpc_error_string(parent));
-
for (size_t i = 0; i < 2; ++i) {
GRPC_ERROR_UNREF(children[i]);
}
@@ -216,6 +214,33 @@ static void test_special() {
GRPC_ERROR_UNREF(error);
}
+static void test_overflow() {
+ grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Overflow");
+
+ for (size_t i = 0; i < 150; ++i) {
+ error = grpc_error_add_child(error,
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Child"));
+ }
+
+ error = grpc_error_set_int(error, GRPC_ERROR_INT_HTTP2_ERROR, 5);
+ error =
+ grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE,
+ grpc_slice_from_static_string("message for child 2"));
+ error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS, 5);
+
+ intptr_t i;
+ GPR_ASSERT(grpc_error_get_int(error, GRPC_ERROR_INT_HTTP2_ERROR, &i));
+ GPR_ASSERT(i == 5);
+ GPR_ASSERT(!grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, &i));
+
+ error = grpc_error_set_int(error, GRPC_ERROR_INT_HTTP2_ERROR, 10);
+ GPR_ASSERT(grpc_error_get_int(error, GRPC_ERROR_INT_HTTP2_ERROR, &i));
+ GPR_ASSERT(i == 10);
+
+ GRPC_ERROR_UNREF(error);
+ ;
+}
+
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
@@ -228,6 +253,7 @@ int main(int argc, char** argv) {
test_create_referencing();
test_create_referencing_many();
test_special();
+ test_overflow();
grpc_shutdown();
return 0;