Merge branch 'master' into i_know_rubies

pull/6010/head
Vijay Pai 9 years ago
commit 828558ac4a
  1. 37
      BUILD
  2. 152
      Makefile
  3. 82
      build.yaml
  4. 14
      src/core/ext/transport/chttp2/transport/hpack_parser.c
  5. 12
      src/core/ext/transport/chttp2/transport/hpack_table.c
  6. 14
      src/core/lib/channel/channel_args.h
  7. 43
      src/core/lib/client_config/lb_policies/pick_first.c
  8. 49
      src/core/lib/client_config/lb_policies/round_robin.c
  9. 5
      src/core/lib/client_config/lb_policy_factory.c
  10. 15
      src/core/lib/client_config/lb_policy_factory.h
  11. 4
      src/core/lib/client_config/lb_policy_registry.c
  12. 3
      src/core/lib/client_config/lb_policy_registry.h
  13. 23
      src/core/lib/client_config/resolvers/dns_resolver.c
  14. 52
      src/core/lib/client_config/resolvers/sockaddr_resolver.c
  15. 24
      src/core/lib/client_config/resolvers/zookeeper_resolver.c
  16. 10
      src/core/lib/http/parser.c
  17. 2
      src/core/lib/iomgr/pollset_set_windows.c
  18. 7
      src/core/lib/json/json_reader.c
  19. 15
      src/ruby/ext/grpc/rb_byte_buffer.c
  20. 14
      src/ruby/ext/grpc/rb_call.c
  21. 30
      templates/BUILD.template
  22. 5
      templates/Makefile.template
  23. 4
      templates/tools/dockerfile/clang_update.include
  24. 43
      templates/tools/dockerfile/test/fuzzer/Dockerfile.template
  25. 44
      templates/tools/fuzzer/runners.template
  26. 2
      templates/vsprojects/buildtests_c.sln.template
  27. 2
      templates/vsprojects/grpc.sln.template
  28. 2
      templates/vsprojects/vcxproj.template
  29. 8
      test/core/client_config/lb_policies_test.c
  30. 1
      test/core/client_config/uri_corpus/042dc4512fa3d391c5170cf3aa61e6a638f84342
  31. 1
      test/core/client_config/uri_corpus/0e9bbe975f2027e8c39c89f85f667530368e7d11
  32. 1
      test/core/client_config/uri_corpus/14b57bcbf1e17b1db1de491ef2ba3768f704b7dc
  33. 2
      test/core/client_config/uri_corpus/1794310671a060eead6e5ee66ac978a18ec7e84f
  34. 1
      test/core/client_config/uri_corpus/1d30b2a79afbaf2828ff42b9a9647e942ba1ab80
  35. 3
      test/core/client_config/uri_corpus/1fcf5d9c333b70596cf5ba04d1f7affdf445b971
  36. 1
      test/core/client_config/uri_corpus/23162c8a8936e20b195404c21337ee734d02a6bc
  37. 1
      test/core/client_config/uri_corpus/23f3198b815ca60bdadcaae682b9f965dda387f1
  38. 2
      test/core/client_config/uri_corpus/2ef3893b43f1f60b77b59ce06a6bce9815d78eaf
  39. 1
      test/core/client_config/uri_corpus/356c3c129e203b5c74550b4209764d74b9caefce
  40. 4
      test/core/client_config/uri_corpus/3b58860f3451d3e7aad99690a8d39782ca5116fc
  41. 1
      test/core/client_config/uri_corpus/47b5228404451fc9d4071fa69192514bb4ce33c1
  42. 4
      test/core/client_config/uri_corpus/636c5606fc23713a1bae88c8899c0541cfad4fd8
  43. 1
      test/core/client_config/uri_corpus/63fe493b270b17426d77a27cbf3abac5b2c2794a
  44. 1
      test/core/client_config/uri_corpus/655300a902b62662296a8e46bfb04fbcb07182cb
  45. 1
      test/core/client_config/uri_corpus/6b70979a70a038ff6607d6cf85485ee95baf58e6
  46. 2
      test/core/client_config/uri_corpus/7314ab3545a7535a26e0e8aad67caea5534d68b1
  47. 1
      test/core/client_config/uri_corpus/884dcaee2908ffe5f12b65b8eba81016099c4266
  48. 2
      test/core/client_config/uri_corpus/96c8d266b7dc037288ef305c996608270f72e7fb
  49. 1
      test/core/client_config/uri_corpus/975536c71ade4800415a7e9c2f1b45c35a6d5ea8
  50. 1
      test/core/client_config/uri_corpus/99750aa67d30beaea8af565c829d4999aa8cb91b
  51. 1
      test/core/client_config/uri_corpus/a1f0f9b75bb354eb063d7cba4fcfa2d0b88d63de
  52. 1
      test/core/client_config/uri_corpus/a296eb3d1d436ed7df7195b10aa3c4de3896f98d
  53. 1
      test/core/client_config/uri_corpus/a8b8e66050b424f1b8c07d46f868199fb7f60e38
  54. 1
      test/core/client_config/uri_corpus/af55baf8c8855e563befdf1eefbcbd46c5ddb8d2
  55. 1
      test/core/client_config/uri_corpus/b3c0bf66c2bf5d24ef1daf4cc5a9d6d5bd0e8bfd
  56. 1
      test/core/client_config/uri_corpus/ceb4e2264ba7a8d5be47d276b37ec09489e00245
  57. 1
      test/core/client_config/uri_corpus/cf4395958f5bfb46fd6f535a39657d016c75114c
  58. 1
      test/core/client_config/uri_corpus/d46668372b7e20154a89409a7430a28e642afdca
  59. 1
      test/core/client_config/uri_corpus/d6fe7412a0a1d1c733160246f3fa425f4f97682a
  60. 1
      test/core/client_config/uri_corpus/dns.txt
  61. 4
      test/core/client_config/uri_corpus/ea02d9fea9bad5b89cf353a0169238f584177e71
  62. 1
      test/core/client_config/uri_corpus/ec4731dddf94ed3ea92ae4d5a71f145ab6e3f6ee
  63. 1
      test/core/client_config/uri_corpus/ed2f78646f19fc47dd85ff0877c232b71913ece2
  64. 2
      test/core/client_config/uri_corpus/f6889f4a6350fea1596a3adea5cdac02bd5d1ff3
  65. 1
      test/core/client_config/uri_corpus/f6f3bd030f0d321efe7c51ca3f057de23509af67
  66. 2
      test/core/client_config/uri_corpus/f97598cff03306af3c70400608fec47268b5075d
  67. 1
      test/core/client_config/uri_corpus/f9e1ec1fc642b575bc9955618b7065747f56b101
  68. 1
      test/core/client_config/uri_corpus/fe0630a3aeed2ec6f474f362e4c839478290d5c4
  69. 1
      test/core/client_config/uri_corpus/ipv4.txt
  70. 1
      test/core/client_config/uri_corpus/ipv6.txt
  71. 1
      test/core/client_config/uri_corpus/unix.txt
  72. 52
      test/core/client_config/uri_fuzzer_test.c
  73. 2
      test/core/http/corpus/0299ca2580e4398d170c4a336e0c33eb2cd9d427
  74. 2
      test/core/http/corpus/05e613853d64a9669ea3cf41b0de777dc24931ba
  75. 2
      test/core/http/corpus/069352518a1d1baa05f317c677d275cefda2ac97
  76. 2
      test/core/http/corpus/0925527c9358b1e10ec0f0387cd99f35204d9a34
  77. 4
      test/core/http/corpus/0c5b7c2569410b526605e308309a7f36574e530d
  78. 3
      test/core/http/corpus/0ef3d0a84360bb5ad66274f1226f5cb273ecdbcf
  79. 3
      test/core/http/corpus/1e1273f90187fdf5df3625764245610f86af6aa4
  80. 3
      test/core/http/corpus/1fbc57d118f3733287e9a9d808bb8947b3260e55
  81. 2
      test/core/http/corpus/24756c396bc72894fd720092bb6f9c03e66b469f
  82. 2
      test/core/http/corpus/276def41311933421ae7a9ee42e906c85b6a4d3f
  83. 2
      test/core/http/corpus/29daa75432381937fd005cb25e314e328de6e9f9
  84. 2
      test/core/http/corpus/2a75204bc492084ad853682f8de3fb137d5907bc
  85. 2
      test/core/http/corpus/2d34ba249b755a880525cf53c665633a5e359305
  86. 2
      test/core/http/corpus/33f4ea0c7ea27c37d8f95cfa64d282370efdafd2
  87. 4
      test/core/http/corpus/35554617ea6418bd43161fe9a2c337ed82d7ec5b
  88. 2
      test/core/http/corpus/35f0c561297cfc840ddaeebb9fc61091f4eadece
  89. 3
      test/core/http/corpus/3953688866ccb3b4f371f1a858570d6afdb6452d
  90. 2
      test/core/http/corpus/39b19c41ba537f37511eff7727733715db432e76
  91. 3
      test/core/http/corpus/3e3c4756d5e40b5aa250954cbac86b826e70a7ac
  92. 2
      test/core/http/corpus/3f03265921120c6ffa61b944e213e062a5538d4b
  93. 2
      test/core/http/corpus/3fb034e66ee5494a67acae1b4e6ff64ba92a2046
  94. 4
      test/core/http/corpus/466059ed07a0d55d6ad5e522c7d367cbf278eaf9
  95. 2
      test/core/http/corpus/487725eb38511c79a9340bf4560a1411061fa6fa
  96. 2
      test/core/http/corpus/48b9b205cae8ac21512a3f26f49fd53e21ee13c5
  97. 2
      test/core/http/corpus/4b1f1f79a0bfa3f942479dd5f8edb59a7c257c55
  98. 3
      test/core/http/corpus/5028c56a5116a186b7343ff59567b47347a0796d
  99. 4
      test/core/http/corpus/533f62b3f495ce704babf3ee8d840f196a714dff
  100. 2
      test/core/http/corpus/5892cbb284771fc9761caae37b19cd6e27dbc104
  101. Some files were not shown because too many files have changed in this diff Show More

37
BUILD

@ -41,6 +41,7 @@ package(default_visibility = ["//visibility:public"])
cc_library( cc_library(
name = "gpr", name = "gpr",
srcs = [ srcs = [
@ -154,6 +155,7 @@ cc_library(
) )
cc_library( cc_library(
name = "grpc", name = "grpc",
srcs = [ srcs = [
@ -294,10 +296,6 @@ cc_library(
"src/core/lib/tsi/ssl_types.h", "src/core/lib/tsi/ssl_types.h",
"src/core/lib/tsi/transport_security.h", "src/core/lib/tsi/transport_security.h",
"src/core/lib/tsi/transport_security_interface.h", "src/core/lib/tsi/transport_security_interface.h",
"third_party/nanopb/pb.h",
"third_party/nanopb/pb_common.h",
"third_party/nanopb/pb_decode.h",
"third_party/nanopb/pb_encode.h",
"src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c",
"src/core/ext/transport/chttp2/client/secure/secure_channel_create.c", "src/core/ext/transport/chttp2/client/secure/secure_channel_create.c",
"src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c",
@ -459,9 +457,6 @@ cc_library(
"src/core/lib/tsi/fake_transport_security.c", "src/core/lib/tsi/fake_transport_security.c",
"src/core/lib/tsi/ssl_transport_security.c", "src/core/lib/tsi/ssl_transport_security.c",
"src/core/lib/tsi/transport_security.c", "src/core/lib/tsi/transport_security.c",
"third_party/nanopb/pb_common.c",
"third_party/nanopb/pb_decode.c",
"third_party/nanopb/pb_encode.c",
], ],
hdrs = [ hdrs = [
"include/grpc/byte_buffer.h", "include/grpc/byte_buffer.h",
@ -486,6 +481,7 @@ cc_library(
"//external:libssl", "//external:libssl",
"//external:zlib", "//external:zlib",
":gpr", ":gpr",
"//external:nanopb",
], ],
copts = [ copts = [
"-std=gnu99", "-std=gnu99",
@ -493,6 +489,7 @@ cc_library(
) )
cc_library( cc_library(
name = "grpc_codegen_lib", name = "grpc_codegen_lib",
srcs = [ srcs = [
@ -529,6 +526,7 @@ cc_library(
) )
cc_library( cc_library(
name = "grpc_unsecure", name = "grpc_unsecure",
srcs = [ srcs = [
@ -655,10 +653,6 @@ cc_library(
"src/core/lib/transport/static_metadata.h", "src/core/lib/transport/static_metadata.h",
"src/core/lib/transport/transport.h", "src/core/lib/transport/transport.h",
"src/core/lib/transport/transport_impl.h", "src/core/lib/transport/transport_impl.h",
"third_party/nanopb/pb.h",
"third_party/nanopb/pb_common.h",
"third_party/nanopb/pb_decode.h",
"third_party/nanopb/pb_encode.h",
"src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c",
"src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c",
"src/core/ext/transport/chttp2/transport/alpn.c", "src/core/ext/transport/chttp2/transport/alpn.c",
@ -800,9 +794,6 @@ cc_library(
"src/core/lib/transport/static_metadata.c", "src/core/lib/transport/static_metadata.c",
"src/core/lib/transport/transport.c", "src/core/lib/transport/transport.c",
"src/core/lib/transport/transport_op_string.c", "src/core/lib/transport/transport_op_string.c",
"third_party/nanopb/pb_common.c",
"third_party/nanopb/pb_decode.c",
"third_party/nanopb/pb_encode.c",
], ],
hdrs = [ hdrs = [
"include/grpc/byte_buffer.h", "include/grpc/byte_buffer.h",
@ -824,6 +815,7 @@ cc_library(
], ],
deps = [ deps = [
":gpr", ":gpr",
"//external:nanopb",
], ],
copts = [ copts = [
"-std=gnu99", "-std=gnu99",
@ -831,6 +823,7 @@ cc_library(
) )
cc_library( cc_library(
name = "grpc_zookeeper", name = "grpc_zookeeper",
srcs = [ srcs = [
@ -851,6 +844,7 @@ cc_library(
) )
cc_library( cc_library(
name = "grpc++", name = "grpc++",
srcs = [ srcs = [
@ -983,6 +977,7 @@ cc_library(
) )
cc_library( cc_library(
name = "grpc++_codegen_lib", name = "grpc++_codegen_lib",
srcs = [ srcs = [
@ -1046,10 +1041,12 @@ cc_library(
".", ".",
], ],
deps = [ deps = [
"//external:protobuf_clib",
], ],
) )
cc_library( cc_library(
name = "grpc++_unsecure", name = "grpc++_unsecure",
srcs = [ srcs = [
@ -1174,6 +1171,7 @@ cc_library(
) )
cc_library( cc_library(
name = "grpc_plugin_support", name = "grpc_plugin_support",
srcs = [ srcs = [
@ -1225,6 +1223,7 @@ cc_library(
) )
cc_library( cc_library(
name = "grpc_csharp_ext", name = "grpc_csharp_ext",
srcs = [ srcs = [
@ -1244,6 +1243,7 @@ cc_library(
objc_library( objc_library(
name = "gpr_objc", name = "gpr_objc",
srcs = [ srcs = [
@ -1357,6 +1357,7 @@ objc_library(
) )
objc_library( objc_library(
name = "grpc_objc", name = "grpc_objc",
srcs = [ srcs = [
@ -1521,9 +1522,6 @@ objc_library(
"src/core/lib/tsi/fake_transport_security.c", "src/core/lib/tsi/fake_transport_security.c",
"src/core/lib/tsi/ssl_transport_security.c", "src/core/lib/tsi/ssl_transport_security.c",
"src/core/lib/tsi/transport_security.c", "src/core/lib/tsi/transport_security.c",
"third_party/nanopb/pb_common.c",
"third_party/nanopb/pb_decode.c",
"third_party/nanopb/pb_encode.c",
], ],
hdrs = [ hdrs = [
"include/grpc/byte_buffer.h", "include/grpc/byte_buffer.h",
@ -1676,10 +1674,6 @@ objc_library(
"src/core/lib/tsi/ssl_types.h", "src/core/lib/tsi/ssl_types.h",
"src/core/lib/tsi/transport_security.h", "src/core/lib/tsi/transport_security.h",
"src/core/lib/tsi/transport_security_interface.h", "src/core/lib/tsi/transport_security_interface.h",
"third_party/nanopb/pb.h",
"third_party/nanopb/pb_common.h",
"third_party/nanopb/pb_decode.h",
"third_party/nanopb/pb_encode.h",
], ],
includes = [ includes = [
"include", "include",
@ -1688,6 +1682,7 @@ objc_library(
deps = [ deps = [
":gpr_objc", ":gpr_objc",
"//external:libssl_objc", "//external:libssl_objc",
"//external:nanopb",
], ],
sdk_dylibs = ["libz"], sdk_dylibs = ["libz"],
) )

@ -95,6 +95,16 @@ LDXX_opt = $(DEFAULT_CXX)
CPPFLAGS_opt = -O2 CPPFLAGS_opt = -O2
DEFINES_opt = NDEBUG DEFINES_opt = NDEBUG
VALID_CONFIG_asan-trace-cmp = 1
REQUIRE_CUSTOM_LIBRARIES_asan-trace-cmp = 1
CC_asan-trace-cmp = clang
CXX_asan-trace-cmp = clang++
LD_asan-trace-cmp = clang
LDXX_asan-trace-cmp = clang++
CPPFLAGS_asan-trace-cmp = -O0 -fsanitize-coverage=edge -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS
LDFLAGS_asan-trace-cmp = -fsanitize=address
DEFINES_asan-trace-cmp += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3
VALID_CONFIG_dbg = 1 VALID_CONFIG_dbg = 1
CC_dbg = $(DEFAULT_CC) CC_dbg = $(DEFAULT_CC)
CXX_dbg = $(DEFAULT_CXX) CXX_dbg = $(DEFAULT_CXX)
@ -109,7 +119,7 @@ CC_easan = clang
CXX_easan = clang++ CXX_easan = clang++
LD_easan = clang LD_easan = clang
LDXX_easan = clang++ LDXX_easan = clang++
CPPFLAGS_easan = -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CPPFLAGS_easan = -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS
LDFLAGS_easan = -fsanitize=address LDFLAGS_easan = -fsanitize=address
DEFINES_easan = _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER DEFINES_easan = _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER
DEFINES_easan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3 DEFINES_easan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3
@ -120,7 +130,7 @@ CC_asan = clang
CXX_asan = clang++ CXX_asan = clang++
LD_asan = clang LD_asan = clang
LDXX_asan = clang++ LDXX_asan = clang++
CPPFLAGS_asan = -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CPPFLAGS_asan = -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS
LDFLAGS_asan = -fsanitize=address LDFLAGS_asan = -fsanitize=address
DEFINES_asan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3 DEFINES_asan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3
@ -130,7 +140,7 @@ CC_msan = clang
CXX_msan = clang++ CXX_msan = clang++
LD_msan = clang LD_msan = clang
LDXX_msan = clang++ LDXX_msan = clang++
CPPFLAGS_msan = -O0 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS CPPFLAGS_msan = -O0 -fsanitize-coverage=edge -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS
LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,) LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,)
DEFINES_msan = NDEBUG DEFINES_msan = NDEBUG
DEFINES_msan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=4 DEFINES_msan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=4
@ -159,7 +169,7 @@ CC_asan-noleaks = clang
CXX_asan-noleaks = clang++ CXX_asan-noleaks = clang++
LD_asan-noleaks = clang LD_asan-noleaks = clang
LDXX_asan-noleaks = clang++ LDXX_asan-noleaks = clang++
CPPFLAGS_asan-noleaks = -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CPPFLAGS_asan-noleaks = -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS
LDFLAGS_asan-noleaks = -fsanitize=address LDFLAGS_asan-noleaks = -fsanitize=address
DEFINES_asan-noleaks += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3 DEFINES_asan-noleaks += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3
@ -177,7 +187,7 @@ CC_ubsan = clang
CXX_ubsan = clang++ CXX_ubsan = clang++
LD_ubsan = clang LD_ubsan = clang
LDXX_ubsan = clang++ LDXX_ubsan = clang++
CPPFLAGS_ubsan = -O1 -fsanitize=undefined -fno-omit-frame-pointer -Wno-unused-command-line-argument CPPFLAGS_ubsan = -O1 -fsanitize-coverage=edge -fsanitize=undefined -fno-omit-frame-pointer -Wno-unused-command-line-argument
LDFLAGS_ubsan = -fsanitize=undefined LDFLAGS_ubsan = -fsanitize=undefined
DEFINES_ubsan = NDEBUG DEFINES_ubsan = NDEBUG
DEFINES_ubsan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=1.5 DEFINES_ubsan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=1.5
@ -925,14 +935,17 @@ grpc_jwt_verifier_test: $(BINDIR)/$(CONFIG)/grpc_jwt_verifier_test
grpc_print_google_default_creds_token: $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token grpc_print_google_default_creds_token: $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token
grpc_security_connector_test: $(BINDIR)/$(CONFIG)/grpc_security_connector_test grpc_security_connector_test: $(BINDIR)/$(CONFIG)/grpc_security_connector_test
grpc_verify_jwt: $(BINDIR)/$(CONFIG)/grpc_verify_jwt grpc_verify_jwt: $(BINDIR)/$(CONFIG)/grpc_verify_jwt
hpack_parser_fuzzer_test: $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test
hpack_parser_test: $(BINDIR)/$(CONFIG)/hpack_parser_test hpack_parser_test: $(BINDIR)/$(CONFIG)/hpack_parser_test
hpack_table_test: $(BINDIR)/$(CONFIG)/hpack_table_test hpack_table_test: $(BINDIR)/$(CONFIG)/hpack_table_test
http_fuzzer_test: $(BINDIR)/$(CONFIG)/http_fuzzer_test
http_parser_test: $(BINDIR)/$(CONFIG)/http_parser_test http_parser_test: $(BINDIR)/$(CONFIG)/http_parser_test
httpcli_format_request_test: $(BINDIR)/$(CONFIG)/httpcli_format_request_test httpcli_format_request_test: $(BINDIR)/$(CONFIG)/httpcli_format_request_test
httpcli_test: $(BINDIR)/$(CONFIG)/httpcli_test httpcli_test: $(BINDIR)/$(CONFIG)/httpcli_test
httpscli_test: $(BINDIR)/$(CONFIG)/httpscli_test httpscli_test: $(BINDIR)/$(CONFIG)/httpscli_test
init_test: $(BINDIR)/$(CONFIG)/init_test init_test: $(BINDIR)/$(CONFIG)/init_test
invalid_call_argument_test: $(BINDIR)/$(CONFIG)/invalid_call_argument_test invalid_call_argument_test: $(BINDIR)/$(CONFIG)/invalid_call_argument_test
json_fuzzer_test: $(BINDIR)/$(CONFIG)/json_fuzzer_test
json_rewrite: $(BINDIR)/$(CONFIG)/json_rewrite json_rewrite: $(BINDIR)/$(CONFIG)/json_rewrite
json_rewrite_test: $(BINDIR)/$(CONFIG)/json_rewrite_test json_rewrite_test: $(BINDIR)/$(CONFIG)/json_rewrite_test
json_stream_error_test: $(BINDIR)/$(CONFIG)/json_stream_error_test json_stream_error_test: $(BINDIR)/$(CONFIG)/json_stream_error_test
@ -966,6 +979,7 @@ transport_connectivity_state_test: $(BINDIR)/$(CONFIG)/transport_connectivity_st
transport_metadata_test: $(BINDIR)/$(CONFIG)/transport_metadata_test transport_metadata_test: $(BINDIR)/$(CONFIG)/transport_metadata_test
transport_security_test: $(BINDIR)/$(CONFIG)/transport_security_test transport_security_test: $(BINDIR)/$(CONFIG)/transport_security_test
udp_server_test: $(BINDIR)/$(CONFIG)/udp_server_test udp_server_test: $(BINDIR)/$(CONFIG)/udp_server_test
uri_fuzzer_test: $(BINDIR)/$(CONFIG)/uri_fuzzer_test
uri_parser_test: $(BINDIR)/$(CONFIG)/uri_parser_test uri_parser_test: $(BINDIR)/$(CONFIG)/uri_parser_test
workqueue_test: $(BINDIR)/$(CONFIG)/workqueue_test workqueue_test: $(BINDIR)/$(CONFIG)/workqueue_test
alarm_cpp_test: $(BINDIR)/$(CONFIG)/alarm_cpp_test alarm_cpp_test: $(BINDIR)/$(CONFIG)/alarm_cpp_test
@ -7786,6 +7800,38 @@ endif
endif endif
HPACK_PARSER_FUZZER_TEST_SRC = \
test/core/transport/chttp2/hpack_parser_fuzzer_test.c \
HPACK_PARSER_FUZZER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HPACK_PARSER_FUZZER_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test: $(HPACK_PARSER_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(HPACK_PARSER_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -lFuzzer -o $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test
endif
$(OBJDIR)/$(CONFIG)/test/core/transport/chttp2/hpack_parser_fuzzer_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_hpack_parser_fuzzer_test: $(HPACK_PARSER_FUZZER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(HPACK_PARSER_FUZZER_TEST_OBJS:.o=.dep)
endif
endif
HPACK_PARSER_TEST_SRC = \ HPACK_PARSER_TEST_SRC = \
test/core/transport/chttp2/hpack_parser_test.c \ test/core/transport/chttp2/hpack_parser_test.c \
@ -7850,6 +7896,38 @@ endif
endif endif
HTTP_FUZZER_TEST_SRC = \
test/core/http/fuzzer.c \
HTTP_FUZZER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_FUZZER_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/http_fuzzer_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/http_fuzzer_test: $(HTTP_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(HTTP_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -lFuzzer -o $(BINDIR)/$(CONFIG)/http_fuzzer_test
endif
$(OBJDIR)/$(CONFIG)/test/core/http/fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_http_fuzzer_test: $(HTTP_FUZZER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(HTTP_FUZZER_TEST_OBJS:.o=.dep)
endif
endif
HTTP_PARSER_TEST_SRC = \ HTTP_PARSER_TEST_SRC = \
test/core/http/parser_test.c \ test/core/http/parser_test.c \
@ -8042,6 +8120,38 @@ endif
endif endif
JSON_FUZZER_TEST_SRC = \
test/core/json/fuzzer.c \
JSON_FUZZER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(JSON_FUZZER_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/json_fuzzer_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/json_fuzzer_test: $(JSON_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(JSON_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -lFuzzer -o $(BINDIR)/$(CONFIG)/json_fuzzer_test
endif
$(OBJDIR)/$(CONFIG)/test/core/json/fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_json_fuzzer_test: $(JSON_FUZZER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(JSON_FUZZER_TEST_OBJS:.o=.dep)
endif
endif
JSON_REWRITE_SRC = \ JSON_REWRITE_SRC = \
test/core/json/json_rewrite.c \ test/core/json/json_rewrite.c \
@ -9098,6 +9208,38 @@ endif
endif endif
URI_FUZZER_TEST_SRC = \
test/core/client_config/uri_fuzzer_test.c \
URI_FUZZER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(URI_FUZZER_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/uri_fuzzer_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/uri_fuzzer_test: $(URI_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(URI_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -lFuzzer -o $(BINDIR)/$(CONFIG)/uri_fuzzer_test
endif
$(OBJDIR)/$(CONFIG)/test/core/client_config/uri_fuzzer_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_uri_fuzzer_test: $(URI_FUZZER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(URI_FUZZER_TEST_OBJS:.o=.dep)
endif
endif
URI_PARSER_TEST_SRC = \ URI_PARSER_TEST_SRC = \
test/core/client_config/uri_parser_test.c \ test/core/client_config/uri_parser_test.c \

@ -1574,6 +1574,18 @@ targets:
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
- name: hpack_parser_fuzzer_test
build: fuzzer
language: c
src:
- test/core/transport/chttp2/hpack_parser_fuzzer_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- test/core/transport/chttp2/hpack_parser_corpus
- name: hpack_parser_test - name: hpack_parser_test
build: test build: test
language: c language: c
@ -1594,6 +1606,18 @@ targets:
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
- name: http_fuzzer_test
build: fuzzer
language: c
src:
- test/core/http/fuzzer.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- test/core/http/corpus
- name: http_parser_test - name: http_parser_test
build: test build: test
language: c language: c
@ -1662,6 +1686,18 @@ targets:
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
- name: json_fuzzer_test
build: fuzzer
language: c
src:
- test/core/json/fuzzer.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- test/core/json/corpus
- name: json_rewrite - name: json_rewrite
build: test build: test
run: false run: false
@ -2025,6 +2061,18 @@ targets:
- mac - mac
- linux - linux
- posix - posix
- name: uri_fuzzer_test
build: fuzzer
language: c
src:
- test/core/client_config/uri_fuzzer_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- test/core/client_config/uri_corpus
- name: uri_parser_test - name: uri_parser_test
build: test build: test
language: c language: c
@ -2806,8 +2854,8 @@ vspackages:
configs: configs:
asan: asan:
CC: clang CC: clang
CPPFLAGS: -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer
-DGPR_NO_DIRECT_SYSCALLS -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS
CXX: clang++ CXX: clang++
LD: clang LD: clang
LDFLAGS: -fsanitize=address LDFLAGS: -fsanitize=address
@ -2819,8 +2867,8 @@ configs:
timeout_multiplier: 3 timeout_multiplier: 3
asan-noleaks: asan-noleaks:
CC: clang CC: clang
CPPFLAGS: -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer
-DGPR_NO_DIRECT_SYSCALLS -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS
CXX: clang++ CXX: clang++
LD: clang LD: clang
LDFLAGS: -fsanitize=address LDFLAGS: -fsanitize=address
@ -2829,6 +2877,19 @@ configs:
test_environ: test_environ:
ASAN_OPTIONS: detect_leaks=0:color=always ASAN_OPTIONS: detect_leaks=0:color=always
timeout_multiplier: 3 timeout_multiplier: 3
asan-trace-cmp:
CC: clang
CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize-coverage=trace-cmp -fsanitize=address
-fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS
CXX: clang++
LD: clang
LDFLAGS: -fsanitize=address
LDXX: clang++
compile_the_world: true
test_environ:
ASAN_OPTIONS: detect_leaks=1:color=always
LSAN_OPTIONS: suppressions=tools/lsan_suppressions.txt:report_objects=1
timeout_multiplier: 3
basicprof: basicprof:
CPPFLAGS: -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC CPPFLAGS: -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC
DEFINES: NDEBUG DEFINES: NDEBUG
@ -2837,8 +2898,8 @@ configs:
DEFINES: _DEBUG DEBUG DEFINES: _DEBUG DEBUG
easan: easan:
CC: clang CC: clang
CPPFLAGS: -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer
-DGPR_NO_DIRECT_SYSCALLS -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS
CXX: clang++ CXX: clang++
DEFINES: _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER DEFINES: _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER
LD: clang LD: clang
@ -2887,9 +2948,9 @@ configs:
valgrind: --tool=memcheck --leak-check=full valgrind: --tool=memcheck --leak-check=full
msan: msan:
CC: clang CC: clang
CPPFLAGS: -O0 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize=memory -fsanitize-memory-track-origins
-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1
-fPIE -pie -DGPR_NO_DIRECT_SYSCALLS -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS
CXX: clang++ CXX: clang++
DEFINES: NDEBUG DEFINES: NDEBUG
LD: clang LD: clang
@ -2922,7 +2983,8 @@ configs:
timeout_multiplier: 5 timeout_multiplier: 5
ubsan: ubsan:
CC: clang CC: clang
CPPFLAGS: -O1 -fsanitize=undefined -fno-omit-frame-pointer -Wno-unused-command-line-argument CPPFLAGS: -O1 -fsanitize-coverage=edge -fsanitize=undefined -fno-omit-frame-pointer
-Wno-unused-command-line-argument
CXX: clang++ CXX: clang++
DEFINES: NDEBUG DEFINES: NDEBUG
LD: clang LD: clang

@ -52,6 +52,8 @@
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
#include "src/core/lib/support/string.h" #include "src/core/lib/support/string.h"
extern int grpc_http_trace;
typedef enum { typedef enum {
NOT_BINARY, NOT_BINARY,
B64_BYTE0, B64_BYTE0,
@ -723,7 +725,9 @@ static int finish_indexed_field(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
const uint8_t *end) { const uint8_t *end) {
grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index); grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
if (md == NULL) { if (md == NULL) {
if (grpc_http_trace) {
gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index); gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
}
return 0; return 0;
} }
GRPC_MDELEM_REF(md); GRPC_MDELEM_REF(md);
@ -919,7 +923,9 @@ static int parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser *p,
/* finish parsing a max table size change */ /* finish parsing a max table size change */
static int finish_max_tbl_size(grpc_chttp2_hpack_parser *p, const uint8_t *cur, static int finish_max_tbl_size(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
const uint8_t *end) { const uint8_t *end) {
if (grpc_http_trace) {
gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index); gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
}
return grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index) && return grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index) &&
parse_begin(p, cur, end); parse_begin(p, cur, end);
} }
@ -960,7 +966,9 @@ static int parse_error(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
static int parse_illegal_op(grpc_chttp2_hpack_parser *p, const uint8_t *cur, static int parse_illegal_op(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
const uint8_t *end) { const uint8_t *end) {
GPR_ASSERT(cur != end); GPR_ASSERT(cur != end);
if (grpc_http_trace) {
gpr_log(GPR_DEBUG, "Illegal hpack op code %d", *cur); gpr_log(GPR_DEBUG, "Illegal hpack op code %d", *cur);
}
return parse_error(p, cur, end); return parse_error(p, cur, end);
} }
@ -1069,10 +1077,12 @@ static int parse_value4(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
} }
error: error:
if (grpc_http_trace) {
gpr_log(GPR_ERROR, gpr_log(GPR_ERROR,
"integer overflow in hpack integer decoding: have 0x%08x, " "integer overflow in hpack integer decoding: have 0x%08x, "
"got byte 0x%02x on byte 5", "got byte 0x%02x on byte 5",
*p->parsing.value, *cur); *p->parsing.value, *cur);
}
return parse_error(p, cur, end); return parse_error(p, cur, end);
} }
@ -1094,10 +1104,12 @@ static int parse_value5up(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
return parse_next(p, cur + 1, end); return parse_next(p, cur + 1, end);
} }
if (grpc_http_trace) {
gpr_log(GPR_ERROR, gpr_log(GPR_ERROR,
"integer overflow in hpack integer decoding: have 0x%08x, " "integer overflow in hpack integer decoding: have 0x%08x, "
"got byte 0x%02x sometime after byte 5", "got byte 0x%02x sometime after byte 5",
*p->parsing.value, *cur); *p->parsing.value, *cur);
}
return parse_error(p, cur, end); return parse_error(p, cur, end);
} }
@ -1329,7 +1341,9 @@ static is_binary_header is_binary_literal_header(grpc_chttp2_hpack_parser *p) {
static is_binary_header is_binary_indexed_header(grpc_chttp2_hpack_parser *p) { static is_binary_header is_binary_indexed_header(grpc_chttp2_hpack_parser *p) {
grpc_mdelem *elem = grpc_chttp2_hptbl_lookup(&p->table, p->index); grpc_mdelem *elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
if (!elem) { if (!elem) {
if (grpc_http_trace) {
gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index); gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
}
return ERROR_HEADER; return ERROR_HEADER;
} }
return grpc_is_binary_header( return grpc_is_binary_header(

@ -41,6 +41,8 @@
#include "src/core/lib/support/murmur_hash.h" #include "src/core/lib/support/murmur_hash.h"
extern int grpc_http_trace;
static struct { static struct {
const char *key; const char *key;
const char *value; const char *value;
@ -264,12 +266,16 @@ int grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl,
return 1; return 1;
} }
if (bytes > tbl->max_bytes) { if (bytes > tbl->max_bytes) {
if (grpc_http_trace) {
gpr_log(GPR_ERROR, gpr_log(GPR_ERROR,
"Attempt to make hpack table %d bytes when max is %d bytes", bytes, "Attempt to make hpack table %d bytes when max is %d bytes",
tbl->max_bytes); bytes, tbl->max_bytes);
}
return 0; return 0;
} }
if (grpc_http_trace) {
gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes); gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes);
}
while (tbl->mem_used > bytes) { while (tbl->mem_used > bytes) {
evict1(tbl); evict1(tbl);
} }
@ -293,10 +299,12 @@ int grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) {
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD; GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
if (tbl->current_table_bytes > tbl->max_bytes) { if (tbl->current_table_bytes > tbl->max_bytes) {
if (grpc_http_trace) {
gpr_log(GPR_ERROR, gpr_log(GPR_ERROR,
"HPACK max table size reduced to %d but not reflected by hpack " "HPACK max table size reduced to %d but not reflected by hpack "
"stream (still at %d)", "stream (still at %d)",
tbl->max_bytes, tbl->current_table_bytes); tbl->max_bytes, tbl->current_table_bytes);
}
return 0; return 0;
} }

@ -37,23 +37,23 @@
#include <grpc/compression.h> #include <grpc/compression.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
/* Copy some arguments */ /** Copy the arguments in \a src into a new instance */
grpc_channel_args *grpc_channel_args_copy(const grpc_channel_args *src); grpc_channel_args *grpc_channel_args_copy(const grpc_channel_args *src);
/* Copy some arguments, stably sorting keys */ /** Copy the arguments in \a src into a new instance, stably sorting keys */
grpc_channel_args *grpc_channel_args_normalize(const grpc_channel_args *a); grpc_channel_args *grpc_channel_args_normalize(const grpc_channel_args *src);
/** Copy some arguments and add the to_add parameter in the end. /** Copy the arguments in \a src and append \a to_add. If \a to_add is NULL, it
If to_add is NULL, it is equivalent to call grpc_channel_args_copy. */ * is equivalent to calling \a grpc_channel_args_copy. */
grpc_channel_args *grpc_channel_args_copy_and_add(const grpc_channel_args *src, grpc_channel_args *grpc_channel_args_copy_and_add(const grpc_channel_args *src,
const grpc_arg *to_add, const grpc_arg *to_add,
size_t num_to_add); size_t num_to_add);
/** Copy args from a then args from b into a new channel args */ /** Concatenate args from \a a and \a b into a new instance */
grpc_channel_args *grpc_channel_args_merge(const grpc_channel_args *a, grpc_channel_args *grpc_channel_args_merge(const grpc_channel_args *a,
const grpc_channel_args *b); const grpc_channel_args *b);
/** Destroy arguments created by grpc_channel_args_copy */ /** Destroy arguments created by \a grpc_channel_args_copy */
void grpc_channel_args_destroy(grpc_channel_args *a); void grpc_channel_args_destroy(grpc_channel_args *a);
/** Reads census_enabled settings from channel args. Returns 1 if census_enabled /** Reads census_enabled settings from channel args. Returns 1 if census_enabled

@ -32,11 +32,11 @@
*/ */
#include "src/core/lib/client_config/lb_policies/pick_first.h" #include "src/core/lib/client_config/lb_policies/pick_first.h"
#include "src/core/lib/client_config/lb_policy_factory.h"
#include <string.h> #include <string.h>
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include "src/core/lib/client_config/lb_policy_factory.h"
#include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/connectivity_state.h"
typedef struct pending_pick { typedef struct pending_pick {
@ -391,19 +391,42 @@ static void pick_first_factory_ref(grpc_lb_policy_factory *factory) {}
static void pick_first_factory_unref(grpc_lb_policy_factory *factory) {} static void pick_first_factory_unref(grpc_lb_policy_factory *factory) {}
static grpc_lb_policy *create_pick_first(grpc_lb_policy_factory *factory, static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx,
grpc_lb_policy_factory *factory,
grpc_lb_policy_args *args) { grpc_lb_policy_args *args) {
if (args->num_subchannels == 0) return NULL; GPR_ASSERT(args->addresses != NULL);
GPR_ASSERT(args->subchannel_factory != NULL);
if (args->addresses->naddrs == 0) return NULL;
pick_first_lb_policy *p = gpr_malloc(sizeof(*p)); pick_first_lb_policy *p = gpr_malloc(sizeof(*p));
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
grpc_lb_policy_init(&p->base, &pick_first_lb_policy_vtable);
p->subchannels = p->subchannels =
gpr_malloc(sizeof(grpc_subchannel *) * args->num_subchannels); gpr_malloc(sizeof(grpc_subchannel *) * args->addresses->naddrs);
p->num_subchannels = args->num_subchannels; memset(p->subchannels, 0, sizeof(*p->subchannels) * args->addresses->naddrs);
grpc_connectivity_state_init(&p->state_tracker, GRPC_CHANNEL_IDLE, grpc_subchannel_args sc_args;
"pick_first"); size_t subchannel_idx = 0;
memcpy(p->subchannels, args->subchannels, for (size_t i = 0; i < args->addresses->naddrs; i++) {
sizeof(grpc_subchannel *) * args->num_subchannels); memset(&sc_args, 0, sizeof(grpc_subchannel_args));
sc_args.addr = (struct sockaddr *)(args->addresses->addrs[i].addr);
sc_args.addr_len = (size_t)args->addresses->addrs[i].len;
grpc_subchannel *subchannel = grpc_subchannel_factory_create_subchannel(
exec_ctx, args->subchannel_factory, &sc_args);
if (subchannel != NULL) {
p->subchannels[subchannel_idx++] = subchannel;
}
}
if (subchannel_idx == 0) {
gpr_free(p->subchannels);
gpr_free(p);
return NULL;
}
p->num_subchannels = subchannel_idx;
grpc_lb_policy_init(&p->base, &pick_first_lb_policy_vtable);
grpc_closure_init(&p->connectivity_changed, pf_connectivity_changed, p); grpc_closure_init(&p->connectivity_changed, pf_connectivity_changed, p);
gpr_mu_init(&p->mu); gpr_mu_init(&p->mu);
return &p->base; return &p->base;

@ -496,30 +496,47 @@ static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {}
static void round_robin_factory_unref(grpc_lb_policy_factory *factory) {} static void round_robin_factory_unref(grpc_lb_policy_factory *factory) {}
static grpc_lb_policy *create_round_robin(grpc_lb_policy_factory *factory, static grpc_lb_policy *create_round_robin(grpc_exec_ctx *exec_ctx,
grpc_lb_policy_factory *factory,
grpc_lb_policy_args *args) { grpc_lb_policy_args *args) {
size_t i; GPR_ASSERT(args->addresses != NULL);
GPR_ASSERT(args->subchannel_factory != NULL);
round_robin_lb_policy *p = gpr_malloc(sizeof(*p)); round_robin_lb_policy *p = gpr_malloc(sizeof(*p));
GPR_ASSERT(args->num_subchannels > 0);
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
grpc_lb_policy_init(&p->base, &round_robin_lb_policy_vtable);
p->num_subchannels = args->num_subchannels;
p->subchannels = gpr_malloc(sizeof(*p->subchannels) * p->num_subchannels);
memset(p->subchannels, 0, sizeof(*p->subchannels) * p->num_subchannels);
grpc_connectivity_state_init(&p->state_tracker, GRPC_CHANNEL_IDLE,
"round_robin");
gpr_mu_init(&p->mu); p->subchannels =
for (i = 0; i < args->num_subchannels; i++) { gpr_malloc(sizeof(*p->subchannels) * args->addresses->naddrs);
memset(p->subchannels, 0, sizeof(*p->subchannels) * args->addresses->naddrs);
grpc_subchannel_args sc_args;
size_t subchannel_idx = 0;
for (size_t i = 0; i < args->addresses->naddrs; i++) {
memset(&sc_args, 0, sizeof(grpc_subchannel_args));
sc_args.addr = (struct sockaddr *)(args->addresses->addrs[i].addr);
sc_args.addr_len = (size_t)args->addresses->addrs[i].len;
grpc_subchannel *subchannel = grpc_subchannel_factory_create_subchannel(
exec_ctx, args->subchannel_factory, &sc_args);
if (subchannel != NULL) {
subchannel_data *sd = gpr_malloc(sizeof(*sd)); subchannel_data *sd = gpr_malloc(sizeof(*sd));
memset(sd, 0, sizeof(*sd)); memset(sd, 0, sizeof(*sd));
p->subchannels[i] = sd; p->subchannels[subchannel_idx] = sd;
sd->policy = p; sd->policy = p;
sd->index = i; sd->index = subchannel_idx;
sd->subchannel = args->subchannels[i]; sd->subchannel = subchannel;
++subchannel_idx;
grpc_closure_init(&sd->connectivity_changed_closure, grpc_closure_init(&sd->connectivity_changed_closure,
rr_connectivity_changed, sd); rr_connectivity_changed, sd);
} }
}
if (subchannel_idx == 0) {
gpr_free(p->subchannels);
gpr_free(p);
return NULL;
}
p->num_subchannels = subchannel_idx;
/* The (dummy node) root of the ready list */ /* The (dummy node) root of the ready list */
p->ready_list.subchannel = NULL; p->ready_list.subchannel = NULL;
@ -527,6 +544,10 @@ static grpc_lb_policy *create_round_robin(grpc_lb_policy_factory *factory,
p->ready_list.next = NULL; p->ready_list.next = NULL;
p->ready_list_last_pick = &p->ready_list; p->ready_list_last_pick = &p->ready_list;
grpc_lb_policy_init(&p->base, &round_robin_lb_policy_vtable);
grpc_connectivity_state_init(&p->state_tracker, GRPC_CHANNEL_IDLE,
"round_robin");
gpr_mu_init(&p->mu);
return &p->base; return &p->base;
} }

@ -42,7 +42,8 @@ void grpc_lb_policy_factory_unref(grpc_lb_policy_factory* factory) {
} }
grpc_lb_policy* grpc_lb_policy_factory_create_lb_policy( grpc_lb_policy* grpc_lb_policy_factory_create_lb_policy(
grpc_lb_policy_factory* factory, grpc_lb_policy_args* args) { grpc_exec_ctx* exec_ctx, grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
if (factory == NULL) return NULL; if (factory == NULL) return NULL;
return factory->vtable->create_lb_policy(factory, args); return factory->vtable->create_lb_policy(exec_ctx, factory, args);
} }

@ -35,7 +35,10 @@
#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H #define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H
#include "src/core/lib/client_config/lb_policy.h" #include "src/core/lib/client_config/lb_policy.h"
#include "src/core/lib/client_config/subchannel.h" #include "src/core/lib/client_config/subchannel_factory.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/exec_ctx.h"
typedef struct grpc_lb_policy_factory grpc_lb_policy_factory; typedef struct grpc_lb_policy_factory grpc_lb_policy_factory;
typedef struct grpc_lb_policy_factory_vtable grpc_lb_policy_factory_vtable; typedef struct grpc_lb_policy_factory_vtable grpc_lb_policy_factory_vtable;
@ -47,8 +50,8 @@ struct grpc_lb_policy_factory {
}; };
typedef struct grpc_lb_policy_args { typedef struct grpc_lb_policy_args {
grpc_subchannel **subchannels; grpc_resolved_addresses *addresses;
size_t num_subchannels; grpc_subchannel_factory *subchannel_factory;
} grpc_lb_policy_args; } grpc_lb_policy_args;
struct grpc_lb_policy_factory_vtable { struct grpc_lb_policy_factory_vtable {
@ -56,7 +59,8 @@ struct grpc_lb_policy_factory_vtable {
void (*unref)(grpc_lb_policy_factory *factory); void (*unref)(grpc_lb_policy_factory *factory);
/** Implementation of grpc_lb_policy_factory_create_lb_policy */ /** Implementation of grpc_lb_policy_factory_create_lb_policy */
grpc_lb_policy *(*create_lb_policy)(grpc_lb_policy_factory *factory, grpc_lb_policy *(*create_lb_policy)(grpc_exec_ctx *exec_ctx,
grpc_lb_policy_factory *factory,
grpc_lb_policy_args *args); grpc_lb_policy_args *args);
/** Name for the LB policy this factory implements */ /** Name for the LB policy this factory implements */
@ -68,6 +72,7 @@ void grpc_lb_policy_factory_unref(grpc_lb_policy_factory *factory);
/** Create a lb_policy instance. */ /** Create a lb_policy instance. */
grpc_lb_policy *grpc_lb_policy_factory_create_lb_policy( grpc_lb_policy *grpc_lb_policy_factory_create_lb_policy(
grpc_lb_policy_factory *factory, grpc_lb_policy_args *args); grpc_exec_ctx *exec_ctx, grpc_lb_policy_factory *factory,
grpc_lb_policy_args *args);
#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H */ #endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H */

@ -79,10 +79,10 @@ static grpc_lb_policy_factory *lookup_factory(const char *name) {
return NULL; return NULL;
} }
grpc_lb_policy *grpc_lb_policy_create(const char *name, grpc_lb_policy *grpc_lb_policy_create(grpc_exec_ctx *exec_ctx, const char *name,
grpc_lb_policy_args *args) { grpc_lb_policy_args *args) {
grpc_lb_policy_factory *factory = lookup_factory(name); grpc_lb_policy_factory *factory = lookup_factory(name);
grpc_lb_policy *lb_policy = grpc_lb_policy *lb_policy =
grpc_lb_policy_factory_create_lb_policy(factory, args); grpc_lb_policy_factory_create_lb_policy(exec_ctx, factory, args);
return lb_policy; return lb_policy;
} }

@ -35,6 +35,7 @@
#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H #define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
#include "src/core/lib/client_config/lb_policy_factory.h" #include "src/core/lib/client_config/lb_policy_factory.h"
#include "src/core/lib/iomgr/exec_ctx.h"
/** Initialize the registry and set \a default_factory as the factory to be /** Initialize the registry and set \a default_factory as the factory to be
* returned when no name is provided in a lookup */ * returned when no name is provided in a lookup */
@ -48,7 +49,7 @@ void grpc_register_lb_policy(grpc_lb_policy_factory *factory);
* *
* If \a name is NULL, the default factory from \a grpc_lb_policy_registry_init * If \a name is NULL, the default factory from \a grpc_lb_policy_registry_init
* will be returned. */ * will be returned. */
grpc_lb_policy *grpc_lb_policy_create(const char *name, grpc_lb_policy *grpc_lb_policy_create(grpc_exec_ctx *exec_ctx, const char *name,
grpc_lb_policy_args *args); grpc_lb_policy_args *args);
#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H */ #endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H */

@ -162,38 +162,23 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_resolved_addresses *addresses) { grpc_resolved_addresses *addresses) {
dns_resolver *r = arg; dns_resolver *r = arg;
grpc_client_config *config = NULL; grpc_client_config *config = NULL;
grpc_subchannel **subchannels;
grpc_subchannel_args args;
grpc_lb_policy *lb_policy; grpc_lb_policy *lb_policy;
size_t i;
gpr_mu_lock(&r->mu); gpr_mu_lock(&r->mu);
GPR_ASSERT(r->resolving); GPR_ASSERT(r->resolving);
r->resolving = 0; r->resolving = 0;
if (addresses != NULL) { if (addresses != NULL) {
grpc_lb_policy_args lb_policy_args; grpc_lb_policy_args lb_policy_args;
config = grpc_client_config_create(); config = grpc_client_config_create();
subchannels = gpr_malloc(sizeof(grpc_subchannel *) * addresses->naddrs);
size_t naddrs = 0;
for (i = 0; i < addresses->naddrs; i++) {
memset(&args, 0, sizeof(args));
args.addr = (struct sockaddr *)(addresses->addrs[i].addr);
args.addr_len = (size_t)addresses->addrs[i].len;
grpc_subchannel *subchannel = grpc_subchannel_factory_create_subchannel(
exec_ctx, r->subchannel_factory, &args);
if (subchannel != NULL) {
subchannels[naddrs++] = subchannel;
}
}
memset(&lb_policy_args, 0, sizeof(lb_policy_args)); memset(&lb_policy_args, 0, sizeof(lb_policy_args));
lb_policy_args.subchannels = subchannels; lb_policy_args.addresses = addresses;
lb_policy_args.num_subchannels = naddrs; lb_policy_args.subchannel_factory = r->subchannel_factory;
lb_policy = grpc_lb_policy_create(r->lb_policy_name, &lb_policy_args); lb_policy =
grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
if (lb_policy != NULL) { if (lb_policy != NULL) {
grpc_client_config_set_lb_policy(config, lb_policy); grpc_client_config_set_lb_policy(config, lb_policy);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "construction"); GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "construction");
} }
grpc_resolved_addresses_destroy(addresses); grpc_resolved_addresses_destroy(addresses);
gpr_free(subchannels);
} else { } else {
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now); gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now);

@ -58,11 +58,7 @@ typedef struct {
char *lb_policy_name; char *lb_policy_name;
/** the addresses that we've 'resolved' */ /** the addresses that we've 'resolved' */
struct sockaddr_storage *addrs; grpc_resolved_addresses *addresses;
/** the corresponding length of the addresses */
size_t *addrs_len;
/** how many elements in \a addrs */
size_t num_addrs;
/** mutex guarding the rest of the state */ /** mutex guarding the rest of the state */
gpr_mu mu; gpr_mu mu;
@ -125,28 +121,14 @@ static void sockaddr_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx, static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
sockaddr_resolver *r) { sockaddr_resolver *r) {
grpc_client_config *cfg;
grpc_lb_policy *lb_policy;
grpc_lb_policy_args lb_policy_args;
grpc_subchannel **subchannels;
grpc_subchannel_args args;
if (r->next_completion != NULL && !r->published) { if (r->next_completion != NULL && !r->published) {
size_t i; grpc_client_config *cfg = grpc_client_config_create();
cfg = grpc_client_config_create(); grpc_lb_policy_args lb_policy_args;
subchannels = gpr_malloc(sizeof(grpc_subchannel *) * r->num_addrs);
for (i = 0; i < r->num_addrs; i++) {
memset(&args, 0, sizeof(args));
args.addr = (struct sockaddr *)&r->addrs[i];
args.addr_len = r->addrs_len[i];
subchannels[i] = grpc_subchannel_factory_create_subchannel(
exec_ctx, r->subchannel_factory, &args);
}
memset(&lb_policy_args, 0, sizeof(lb_policy_args)); memset(&lb_policy_args, 0, sizeof(lb_policy_args));
lb_policy_args.subchannels = subchannels; lb_policy_args.addresses = r->addresses;
lb_policy_args.num_subchannels = r->num_addrs; lb_policy_args.subchannel_factory = r->subchannel_factory;
lb_policy = grpc_lb_policy_create(r->lb_policy_name, &lb_policy_args); grpc_lb_policy *lb_policy =
gpr_free(subchannels); grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
grpc_client_config_set_lb_policy(cfg, lb_policy); grpc_client_config_set_lb_policy(cfg, lb_policy);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "sockaddr"); GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "sockaddr");
r->published = 1; r->published = 1;
@ -160,8 +142,7 @@ static void sockaddr_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
sockaddr_resolver *r = (sockaddr_resolver *)gr; sockaddr_resolver *r = (sockaddr_resolver *)gr;
gpr_mu_destroy(&r->mu); gpr_mu_destroy(&r->mu);
grpc_subchannel_factory_unref(exec_ctx, r->subchannel_factory); grpc_subchannel_factory_unref(exec_ctx, r->subchannel_factory);
gpr_free(r->addrs); grpc_resolved_addresses_destroy(r->addresses);
gpr_free(r->addrs_len);
gpr_free(r->lb_policy_name); gpr_free(r->lb_policy_name);
gpr_free(r); gpr_free(r);
} }
@ -269,7 +250,6 @@ static void do_nothing(void *ignored) {}
static grpc_resolver *sockaddr_create( static grpc_resolver *sockaddr_create(
grpc_resolver_args *args, const char *default_lb_policy_name, grpc_resolver_args *args, const char *default_lb_policy_name,
int parse(grpc_uri *uri, struct sockaddr_storage *dst, size_t *len)) { int parse(grpc_uri *uri, struct sockaddr_storage *dst, size_t *len)) {
size_t i;
int errors_found = 0; /* GPR_FALSE */ int errors_found = 0; /* GPR_FALSE */
sockaddr_resolver *r; sockaddr_resolver *r;
gpr_slice path_slice; gpr_slice path_slice;
@ -309,15 +289,18 @@ static grpc_resolver *sockaddr_create(
gpr_slice_buffer_init(&path_parts); gpr_slice_buffer_init(&path_parts);
gpr_slice_split(path_slice, ",", &path_parts); gpr_slice_split(path_slice, ",", &path_parts);
r->num_addrs = path_parts.count; r->addresses = gpr_malloc(sizeof(grpc_resolved_addresses));
r->addrs = gpr_malloc(sizeof(struct sockaddr_storage) * r->num_addrs); r->addresses->naddrs = path_parts.count;
r->addrs_len = gpr_malloc(sizeof(*r->addrs_len) * r->num_addrs); r->addresses->addrs =
gpr_malloc(sizeof(grpc_resolved_address) * r->addresses->naddrs);
for (i = 0; i < r->num_addrs; i++) { for (size_t i = 0; i < r->addresses->naddrs; i++) {
grpc_uri ith_uri = *args->uri; grpc_uri ith_uri = *args->uri;
char *part_str = gpr_dump_slice(path_parts.slices[i], GPR_DUMP_ASCII); char *part_str = gpr_dump_slice(path_parts.slices[i], GPR_DUMP_ASCII);
ith_uri.path = part_str; ith_uri.path = part_str;
if (!parse(&ith_uri, &r->addrs[i], &r->addrs_len[i])) { if (!parse(&ith_uri,
(struct sockaddr_storage *)(&r->addresses->addrs[i].addr),
&r->addresses->addrs[i].len)) {
errors_found = 1; /* GPR_TRUE */ errors_found = 1; /* GPR_TRUE */
} }
gpr_free(part_str); gpr_free(part_str);
@ -328,8 +311,7 @@ static grpc_resolver *sockaddr_create(
gpr_slice_unref(path_slice); gpr_slice_unref(path_slice);
if (errors_found) { if (errors_found) {
gpr_free(r->lb_policy_name); gpr_free(r->lb_policy_name);
gpr_free(r->addrs); grpc_resolved_addresses_destroy(r->addresses);
gpr_free(r->addrs_len);
gpr_free(r); gpr_free(r);
return NULL; return NULL;
} }

@ -184,28 +184,22 @@ static void zookeeper_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_resolved_addresses *addresses) { grpc_resolved_addresses *addresses) {
zookeeper_resolver *r = arg; zookeeper_resolver *r = arg;
grpc_client_config *config = NULL; grpc_client_config *config = NULL;
grpc_subchannel **subchannels;
grpc_subchannel_args args;
grpc_lb_policy *lb_policy; grpc_lb_policy *lb_policy;
size_t i;
if (addresses != NULL) { if (addresses != NULL) {
grpc_lb_policy_args lb_policy_args; grpc_lb_policy_args lb_policy_args;
config = grpc_client_config_create(); config = grpc_client_config_create();
subchannels = gpr_malloc(sizeof(grpc_subchannel *) * addresses->naddrs);
for (i = 0; i < addresses->naddrs; i++) { lb_policy_args.addresses = addresses;
memset(&args, 0, sizeof(args)); lb_policy_args.subchannel_factory = r->subchannel_factory;
args.addr = (struct sockaddr *)(addresses->addrs[i].addr); lb_policy =
args.addr_len = addresses->addrs[i].len; grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
subchannels[i] = grpc_subchannel_factory_create_subchannel(
exec_ctx, r->subchannel_factory, &args); if (lb_policy != NULL) {
}
lb_policy_args.subchannels = subchannels;
lb_policy_args.num_subchannels = addresses->naddrs;
lb_policy = grpc_lb_policy_create(r->lb_policy_name, &lb_policy_args);
grpc_client_config_set_lb_policy(config, lb_policy); grpc_client_config_set_lb_policy(config, lb_policy);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "construction"); GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "construction");
}
grpc_resolved_addresses_destroy(addresses); grpc_resolved_addresses_destroy(addresses);
gpr_free(subchannels);
} }
gpr_mu_lock(&r->mu); gpr_mu_lock(&r->mu);
GPR_ASSERT(r->resolving == 1); GPR_ASSERT(r->resolving == 1);

@ -39,6 +39,8 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/useful.h> #include <grpc/support/useful.h>
extern int grpc_http_trace;
static char *buf2str(void *buffer, size_t length) { static char *buf2str(void *buffer, size_t length) {
char *out = gpr_malloc(length + 1); char *out = gpr_malloc(length + 1);
memcpy(out, buffer, length); memcpy(out, buffer, length);
@ -72,7 +74,7 @@ static int handle_response_line(grpc_http_parser *parser) {
return 1; return 1;
error: error:
gpr_log(GPR_ERROR, "Failed parsing response line"); if (grpc_http_trace) gpr_log(GPR_ERROR, "Failed parsing response line");
return 0; return 0;
} }
@ -125,7 +127,7 @@ static int handle_request_line(grpc_http_parser *parser) {
return 1; return 1;
error: error:
gpr_log(GPR_ERROR, "Failed parsing request line"); if (grpc_http_trace) gpr_log(GPR_ERROR, "Failed parsing request line");
return 0; return 0;
} }
@ -150,6 +152,7 @@ static int add_header(grpc_http_parser *parser) {
GPR_ASSERT(cur != end); GPR_ASSERT(cur != end);
if (*cur == ' ' || *cur == '\t') { if (*cur == ' ' || *cur == '\t') {
if (grpc_http_trace)
gpr_log(GPR_ERROR, "Continued header lines not supported yet"); gpr_log(GPR_ERROR, "Continued header lines not supported yet");
goto error; goto error;
} }
@ -158,7 +161,7 @@ static int add_header(grpc_http_parser *parser) {
cur++; cur++;
} }
if (cur == end) { if (cur == end) {
gpr_log(GPR_ERROR, "Didn't find ':' in header string"); if (grpc_http_trace) gpr_log(GPR_ERROR, "Didn't find ':' in header string");
goto error; goto error;
} }
GPR_ASSERT(cur >= beg); GPR_ASSERT(cur >= beg);
@ -249,6 +252,7 @@ static int addbyte(grpc_http_parser *parser, uint8_t byte) {
case GRPC_HTTP_FIRST_LINE: case GRPC_HTTP_FIRST_LINE:
case GRPC_HTTP_HEADERS: case GRPC_HTTP_HEADERS:
if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) { if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) {
if (grpc_http_trace)
gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded", gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded",
GRPC_HTTP_PARSER_MAX_HEADER_LENGTH); GRPC_HTTP_PARSER_MAX_HEADER_LENGTH);
return 0; return 0;

@ -37,7 +37,7 @@
#include "src/core/lib/iomgr/pollset_set_windows.h" #include "src/core/lib/iomgr/pollset_set_windows.h"
grpc_pollset_set* grpc_pollset_set_create(pollset_set) { return NULL; } grpc_pollset_set* grpc_pollset_set_create(void) { return NULL; }
void grpc_pollset_set_destroy(grpc_pollset_set* pollset_set) {} void grpc_pollset_set_destroy(grpc_pollset_set* pollset_set) {}

@ -280,13 +280,14 @@ grpc_json_reader_status grpc_json_reader_run(grpc_json_reader *reader) {
break; break;
case GRPC_JSON_STATE_OBJECT_KEY_STRING: case GRPC_JSON_STATE_OBJECT_KEY_STRING:
GPR_ASSERT(reader->unicode_high_surrogate == 0); if (reader->unicode_high_surrogate != 0)
return GRPC_JSON_PARSE_ERROR;
if (c == '"') { if (c == '"') {
reader->state = GRPC_JSON_STATE_OBJECT_KEY_END; reader->state = GRPC_JSON_STATE_OBJECT_KEY_END;
json_reader_set_key(reader); json_reader_set_key(reader);
json_reader_string_clear(reader); json_reader_string_clear(reader);
} else { } else {
if (c <= 0x001f) return GRPC_JSON_PARSE_ERROR; if (c < 32) return GRPC_JSON_PARSE_ERROR;
json_reader_string_add_char(reader, c); json_reader_string_add_char(reader, c);
} }
break; break;
@ -362,6 +363,8 @@ grpc_json_reader_status grpc_json_reader_run(grpc_json_reader *reader) {
reader->in_object = 0; reader->in_object = 0;
reader->in_array = 1; reader->in_array = 1;
break; break;
default:
return GRPC_JSON_PARSE_ERROR;
} }
break; break;

@ -50,21 +50,18 @@ grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char *string, size_t length) {
} }
VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) { VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) {
size_t length = 0; VALUE rb_string;
char *string = NULL;
size_t offset = 0;
grpc_byte_buffer_reader reader; grpc_byte_buffer_reader reader;
gpr_slice next; gpr_slice next;
if (buffer == NULL) { if (buffer == NULL) {
return Qnil; return Qnil;
} }
length = grpc_byte_buffer_length(buffer); rb_string = rb_str_buf_new(grpc_byte_buffer_length(buffer));
string = xmalloc(length + 1);
grpc_byte_buffer_reader_init(&reader, buffer); grpc_byte_buffer_reader_init(&reader, buffer);
while (grpc_byte_buffer_reader_next(&reader, &next) != 0) { while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
memcpy(string + offset, GPR_SLICE_START_PTR(next), GPR_SLICE_LENGTH(next)); rb_str_cat(rb_string, (const char *) GPR_SLICE_START_PTR(next),
offset += GPR_SLICE_LENGTH(next); GPR_SLICE_LENGTH(next));
gpr_slice_unref(next);
} }
return rb_str_new(string, length); return rb_string;
} }

@ -551,13 +551,26 @@ static void grpc_run_batch_stack_init(run_batch_stack *st,
/* grpc_run_batch_stack_cleanup ensures the run_batch_stack is properly /* grpc_run_batch_stack_cleanup ensures the run_batch_stack is properly
* cleaned up */ * cleaned up */
static void grpc_run_batch_stack_cleanup(run_batch_stack *st) { static void grpc_run_batch_stack_cleanup(run_batch_stack *st) {
size_t i = 0;
grpc_metadata_array_destroy(&st->send_metadata); grpc_metadata_array_destroy(&st->send_metadata);
grpc_metadata_array_destroy(&st->send_trailing_metadata); grpc_metadata_array_destroy(&st->send_trailing_metadata);
grpc_metadata_array_destroy(&st->recv_metadata); grpc_metadata_array_destroy(&st->recv_metadata);
grpc_metadata_array_destroy(&st->recv_trailing_metadata); grpc_metadata_array_destroy(&st->recv_trailing_metadata);
if (st->recv_status_details != NULL) { if (st->recv_status_details != NULL) {
gpr_free(st->recv_status_details); gpr_free(st->recv_status_details);
} }
if (st->recv_message != NULL) {
grpc_byte_buffer_destroy(st->recv_message);
}
for (i = 0; i < st->op_num; i++) {
if (st->ops[i].op == GRPC_OP_SEND_MESSAGE) {
grpc_byte_buffer_destroy(st->ops[i].data.send_message);
}
}
} }
/* grpc_run_batch_stack_fill_ops fills the run_batch_stack ops array from /* grpc_run_batch_stack_fill_ops fills the run_batch_stack ops array from
@ -643,7 +656,6 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack *st) {
break; break;
case GRPC_OP_SEND_MESSAGE: case GRPC_OP_SEND_MESSAGE:
rb_struct_aset(result, sym_send_message, Qtrue); rb_struct_aset(result, sym_send_message, Qtrue);
grpc_byte_buffer_destroy(st->ops[i].data.send_message);
break; break;
case GRPC_OP_SEND_CLOSE_FROM_CLIENT: case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
rb_struct_aset(result, sym_send_close, Qtrue); rb_struct_aset(result, sym_send_close, Qtrue);

@ -49,7 +49,9 @@
] ]
if target_dict.get('build', None) == 'protoc': if target_dict.get('build', None) == 'protoc':
deps.append("//external:protobuf_compiler") deps.append("//external:protobuf_compiler")
if target_dict['name'] == 'grpc++_unsecure' or target_dict['name'] == 'grpc++': if (target_dict['name'] == 'grpc++_unsecure' or
target_dict['name'] == 'grpc++' or
target_dict['name'] == 'grpc++_codegen_lib'):
deps.append("//external:protobuf_clib") deps.append("//external:protobuf_clib")
elif target_dict['name'] == 'grpc': elif target_dict['name'] == 'grpc':
deps.append("//external:zlib") deps.append("//external:zlib")
@ -80,13 +82,19 @@
% endfor % endfor
<%def name="cc_library(lib)"> <%def name="cc_library(lib)">
<%
lib_hdrs = lib.get("headers", [])
hdrs = [h for h in lib_hdrs if not h.startswith('third_party/nanopb')]
srcs = [s for s in lib.src if not s.startswith('third_party/nanopb')]
uses_nanopb = len(lib_hdrs) != len(hdrs) or len(srcs) != len(lib.src)
%>
cc_library( cc_library(
name = "${lib.name}", name = "${lib.name}",
srcs = [ srcs = [
% for hdr in lib.get("headers", []): % for hdr in hdrs:
"${hdr}", "${hdr}",
% endfor % endfor
% for src in lib.src: % for src in srcs:
"${src}", "${src}",
% endfor % endfor
], ],
@ -103,6 +111,9 @@
% for dep in get_deps(lib): % for dep in get_deps(lib):
"${dep}", "${dep}",
% endfor % endfor
% if uses_nanopb:
"//external:nanopb",
% endif
], ],
% if lib.name in ("grpc", "grpc_unsecure"): % if lib.name in ("grpc", "grpc_unsecure"):
copts = [ copts = [
@ -113,10 +124,16 @@
</%def> </%def>
<%def name="objc_library(lib)"> <%def name="objc_library(lib)">
<%
lib_hdrs = lib.get("headers", [])
hdrs = [h for h in lib_hdrs if not h.startswith('third_party/nanopb')]
srcs = [s for s in lib.src if not s.startswith('third_party/nanopb')]
uses_nanopb = len(lib_hdrs) != len(hdrs) or len(srcs) != len(lib.src)
%>
objc_library( objc_library(
name = "${lib.name}_objc", name = "${lib.name}_objc",
srcs = [ srcs = [
% for src in lib.src: % for src in srcs:
"${src}", "${src}",
% endfor % endfor
], ],
@ -124,7 +141,7 @@
% for hdr in lib.get("public_headers", []): % for hdr in lib.get("public_headers", []):
"${hdr}", "${hdr}",
% endfor % endfor
% for hdr in lib.get("headers", []): % for hdr in hdrs:
"${hdr}", "${hdr}",
% endfor % endfor
], ],
@ -138,6 +155,9 @@
% endfor % endfor
% if lib.get('secure', False): % if lib.get('secure', False):
"//external:libssl_objc", "//external:libssl_objc",
% endif
% if uses_nanopb:
"//external:nanopb",
% endif % endif
], ],
% if lib.get("baselib", false): % if lib.get("baselib", false):

@ -1737,7 +1737,7 @@
$(LIBDIR)/$(CONFIG)/lib${dep}.a\ $(LIBDIR)/$(CONFIG)/lib${dep}.a\
% endfor % endfor
% if tgt.language == "c++" or tgt.boringssl: % if tgt.language == "c++" or tgt.boringssl or tgt.build == 'fuzzer':
## C++ targets specificies. ## C++ targets specificies.
% if tgt.build == 'protoc': % if tgt.build == 'protoc':
$(E) "[HOSTLD] Linking $@" $(E) "[HOSTLD] Linking $@"
@ -1790,6 +1790,9 @@
$(GTEST_LIB)\ $(GTEST_LIB)\
% elif tgt.language == 'c++' and tgt.build == 'benchmark': % elif tgt.language == 'c++' and tgt.build == 'benchmark':
$(GTEST_LIB)\ $(GTEST_LIB)\
% endif
% if tgt.build == 'fuzzer':
-lFuzzer\
% endif % endif
-o $(BINDIR)/$(CONFIG)/${tgt.name} -o $(BINDIR)/$(CONFIG)/${tgt.name}
% if tgt.build == 'protoc' or tgt.language == 'c++': % if tgt.build == 'protoc' or tgt.language == 'c++':

@ -1,5 +1,5 @@
#================= #=================
# Update clang to a version with improved tsan # Update clang to a version with improved tsan and fuzzing capabilities
RUN apt-get update && apt-get -y install python cmake && apt-get clean RUN apt-get update && apt-get -y install python cmake && apt-get clean
@ -29,4 +29,4 @@ RUN cd llvm-build && cmake ${'\\'}
-DCMAKE_INSTALL_PREFIX:STRING=/usr ${'\\'} -DCMAKE_INSTALL_PREFIX:STRING=/usr ${'\\'}
-DLLVM_TARGETS_TO_BUILD:STRING=X86 ${'\\'} -DLLVM_TARGETS_TO_BUILD:STRING=X86 ${'\\'}
../llvm ../llvm
RUN make -C llvm-build && make -C llvm-build install && rm -rf llvm-build RUN make -C llvm-build -j 12 && make -C llvm-build install && rm -rf llvm-build

@ -0,0 +1,43 @@
%YAML 1.2
--- |
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FROM debian:jessie
<%include file="../../apt_get_basic.include"/>
<%include file="../../cxx_deps.include"/>
<%include file="../../clang_update.include"/>
<%include file="../../run_tests_addons.include"/>
RUN clang++ -c -g -O2 -std=c++11 llvm/lib/Fuzzer/*.cpp -IFuzzer
RUN ar ruv libFuzzer.a Fuzzer*.o
RUN mv libFuzzer.a /usr/lib
RUN rm -f Fuzzer*.o
# Define the default command.
CMD ["bash"]

@ -0,0 +1,44 @@
%YAML 1.2
---
foreach: targets
cond: selected.build == 'fuzzer'
output_name: ${selected.name}.sh
template: |
#!/bin/bash
# Copyright 2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
flags="-max_total_time=3600 -jobs=3 -workers=3"
if [ "$config" == "asan-trace-cmp" ]
then
flags="-use_traces=1 $flags"
fi
bins/$config/${selected.name} $flags fuzzer_output ${' '.join(selected.corpus_dirs)}

@ -2,6 +2,6 @@
--- | --- |
<%namespace file="sln_defs.include" import="gen_solution"/>\ <%namespace file="sln_defs.include" import="gen_solution"/>\
<% <%
solution_projects = [p for p in vsprojects if p.build != 'protoc' and p.language == 'c' and not p.boringssl and not p.zlib] solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'fuzzer'] and p.language == 'c' and not p.boringssl and not p.zlib]
%>\ %>\
${gen_solution(solution_projects, use_dlls='yes')} ${gen_solution(solution_projects, use_dlls='yes')}

@ -2,6 +2,6 @@
--- | --- |
<%namespace file="sln_defs.include" import="gen_solution"/>\ <%namespace file="sln_defs.include" import="gen_solution"/>\
<% <%
solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'test'] and p.language in ['c', 'c++'] and p.vs_proj_dir == '.' and not (p.build == 'private' and p.language == 'c++')] solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'test', 'fuzzer'] and p.language in ['c', 'c++'] and p.vs_proj_dir == '.' and not (p.build == 'private' and p.language == 'c++')]
%>\ %>\
${gen_solution(solution_projects, use_dlls='yes')} ${gen_solution(solution_projects, use_dlls='yes')}

@ -2,12 +2,14 @@
--- ---
foreach: vsprojects foreach: vsprojects
output_name: ${selected.vs_proj_dir}/${selected.name}/${selected.name}.vcxproj output_name: ${selected.vs_proj_dir}/${selected.name}/${selected.name}.vcxproj
cond: selected.build not in ['fuzzer']
template: | template: |
<%namespace file="vcxproj_defs.include" import="gen_project"/>\ <%namespace file="vcxproj_defs.include" import="gen_project"/>\
${gen_project(selected.name, vsprojects)} ${gen_project(selected.name, vsprojects)}
--- ---
foreach: vsprojects foreach: vsprojects
output_name: ${selected.vs_proj_dir}/${selected.name}/${selected.name}.vcxproj.filters output_name: ${selected.vs_proj_dir}/${selected.name}/${selected.name}.vcxproj.filters
cond: selected.build not in ['fuzzer']
template: | template: |
<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ <%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\
${gen_filters(selected.name, vsprojects)} ${gen_filters(selected.name, vsprojects)}

@ -873,6 +873,7 @@ static void verify_rebirth_round_robin(const servers_fixture *f,
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
test_spec *spec; test_spec *spec;
size_t i; size_t i;
const size_t NUM_ITERS = 10; const size_t NUM_ITERS = 10;
@ -882,9 +883,9 @@ int main(int argc, char **argv) {
grpc_init(); grpc_init();
grpc_lb_round_robin_trace = 1; grpc_lb_round_robin_trace = 1;
GPR_ASSERT(grpc_lb_policy_create("this-lb-policy-does-not-exist", NULL) == GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, "this-lb-policy-does-not-exist",
NULL); NULL) == NULL);
GPR_ASSERT(grpc_lb_policy_create(NULL, NULL) == NULL); GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, NULL, NULL) == NULL);
spec = test_spec_create(NUM_ITERS, NUM_SERVERS); spec = test_spec_create(NUM_ITERS, NUM_SERVERS);
/* everything is fine, all servers stay up the whole time and life's peachy */ /* everything is fine, all servers stay up the whole time and life's peachy */
@ -936,6 +937,7 @@ int main(int argc, char **argv) {
test_pending_calls(4); test_pending_calls(4);
test_ping(); test_ping();
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown(); grpc_shutdown();
return 0; return 0;
} }

@ -0,0 +1,52 @@
/*
*
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <stdint.h>
#include <string.h>
#include <grpc/support/alloc.h>
#include "src/core/lib/client_config/uri_parser.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char *s = gpr_malloc(size + 1);
memcpy(s, data, size);
s[size] = 0;
grpc_uri *x;
if ((x = grpc_uri_parse(s, 1))) {
grpc_uri_destroy(x);
}
gpr_free(s);
return 0;
}

@ -0,0 +1,2 @@
„HTT/21. 200 HT!TP/1OKH.1HTTP 200 OKH
tHT//1T0P.1y 2001.

@ -0,0 +1,3 @@
HTTP/1.1 200 OKH
tHTTP/01.021 Oes,H
tes

@ -0,0 +1,3 @@
HTTP/1.1 200 OKHHTTP‰/1.200 OKH
tHTHTTP/0 20T:tes/01.

@ -0,0 +1,3 @@
JHTT/21. 2è0 HTTP/1.1 200 OKHHTTP‰/1.200 OKH
tHTHTHTJHTTPT

@ -0,0 +1,2 @@
JHTT/21. 200œHTT/0OKH.1 HTTP/200 OKH
tH1.T

@ -0,0 +1,2 @@
ITTP/11 …20O HTTP/11 2*0 OKH
HTDP/01.021 : OesHK ,H

@ -0,0 +1,2 @@
JHTT¹21. 200HTT/0OKH1 HTTP/100 OKH
tH1.T

@ -0,0 +1,2 @@
ITTP/11 …20O HTTP/22 2*0 OKH
HTDP/01.021 : OesHK ,H

@ -0,0 +1,4 @@
JHTT/21. 200 HTTP/0OKH.1 200 OKH
tHTTP/01.021 Oes,H
t
t

@ -0,0 +1,3 @@
žHTTP/1.1 200 HH
OK TDP/01.021 : Oe:,H
tes

@ -0,0 +1,3 @@
HTTP/1.1 200 OKH
tHTTP/01.021 : Oes,H
tes

@ -0,0 +1,4 @@
JHTTP/1.1 +00 HTTP/1.1 200 OKHHTTPOKH <EFBFBD>/1.
200 OKtH
tHTH

@ -0,0 +1,3 @@
HTTP/1.1 200 OKH
HTDP/01.021 : Oes,H
tes

@ -0,0 +1,4 @@
JHTT/21. 200 HTTP/1OKH.1 200 OKH
tHTTP/01.021 Oes,H
t
t

@ -0,0 +1,2 @@
JĎHTTP‰/1.200:OKHHTă/21. 2č0 HTTP/
1.1 200 OKHHTtTP‰

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save