Expand fuzzers

pull/5846/head
Craig Tiller 9 years ago
parent c6d6a024b7
commit 71c610d512
  1. 99
      Makefile
  2. 36
      build.yaml
  3. 14
      src/core/httpcli/parser.c
  4. 40
      src/core/transport/chttp2/hpack_parser.c
  5. 24
      src/core/transport/chttp2/hpack_table.c
  6. 1
      test/core/client_config/uri_corpus/042dc4512fa3d391c5170cf3aa61e6a638f84342
  7. 1
      test/core/client_config/uri_corpus/0e9bbe975f2027e8c39c89f85f667530368e7d11
  8. 1
      test/core/client_config/uri_corpus/14b57bcbf1e17b1db1de491ef2ba3768f704b7dc
  9. 2
      test/core/client_config/uri_corpus/1794310671a060eead6e5ee66ac978a18ec7e84f
  10. 1
      test/core/client_config/uri_corpus/1d30b2a79afbaf2828ff42b9a9647e942ba1ab80
  11. 3
      test/core/client_config/uri_corpus/1fcf5d9c333b70596cf5ba04d1f7affdf445b971
  12. 1
      test/core/client_config/uri_corpus/23162c8a8936e20b195404c21337ee734d02a6bc
  13. 1
      test/core/client_config/uri_corpus/23f3198b815ca60bdadcaae682b9f965dda387f1
  14. 2
      test/core/client_config/uri_corpus/2ef3893b43f1f60b77b59ce06a6bce9815d78eaf
  15. 1
      test/core/client_config/uri_corpus/356c3c129e203b5c74550b4209764d74b9caefce
  16. 4
      test/core/client_config/uri_corpus/3b58860f3451d3e7aad99690a8d39782ca5116fc
  17. 1
      test/core/client_config/uri_corpus/47b5228404451fc9d4071fa69192514bb4ce33c1
  18. 4
      test/core/client_config/uri_corpus/636c5606fc23713a1bae88c8899c0541cfad4fd8
  19. 1
      test/core/client_config/uri_corpus/63fe493b270b17426d77a27cbf3abac5b2c2794a
  20. 1
      test/core/client_config/uri_corpus/655300a902b62662296a8e46bfb04fbcb07182cb
  21. 1
      test/core/client_config/uri_corpus/6b70979a70a038ff6607d6cf85485ee95baf58e6
  22. 2
      test/core/client_config/uri_corpus/7314ab3545a7535a26e0e8aad67caea5534d68b1
  23. 1
      test/core/client_config/uri_corpus/884dcaee2908ffe5f12b65b8eba81016099c4266
  24. 2
      test/core/client_config/uri_corpus/96c8d266b7dc037288ef305c996608270f72e7fb
  25. 1
      test/core/client_config/uri_corpus/975536c71ade4800415a7e9c2f1b45c35a6d5ea8
  26. 1
      test/core/client_config/uri_corpus/99750aa67d30beaea8af565c829d4999aa8cb91b
  27. 1
      test/core/client_config/uri_corpus/a1f0f9b75bb354eb063d7cba4fcfa2d0b88d63de
  28. 1
      test/core/client_config/uri_corpus/a296eb3d1d436ed7df7195b10aa3c4de3896f98d
  29. 1
      test/core/client_config/uri_corpus/a8b8e66050b424f1b8c07d46f868199fb7f60e38
  30. 1
      test/core/client_config/uri_corpus/af55baf8c8855e563befdf1eefbcbd46c5ddb8d2
  31. 1
      test/core/client_config/uri_corpus/b3c0bf66c2bf5d24ef1daf4cc5a9d6d5bd0e8bfd
  32. 1
      test/core/client_config/uri_corpus/ceb4e2264ba7a8d5be47d276b37ec09489e00245
  33. 1
      test/core/client_config/uri_corpus/cf4395958f5bfb46fd6f535a39657d016c75114c
  34. 1
      test/core/client_config/uri_corpus/d46668372b7e20154a89409a7430a28e642afdca
  35. 1
      test/core/client_config/uri_corpus/d6fe7412a0a1d1c733160246f3fa425f4f97682a
  36. 1
      test/core/client_config/uri_corpus/dns.txt
  37. 4
      test/core/client_config/uri_corpus/ea02d9fea9bad5b89cf353a0169238f584177e71
  38. 1
      test/core/client_config/uri_corpus/ec4731dddf94ed3ea92ae4d5a71f145ab6e3f6ee
  39. 1
      test/core/client_config/uri_corpus/ed2f78646f19fc47dd85ff0877c232b71913ece2
  40. 2
      test/core/client_config/uri_corpus/f6889f4a6350fea1596a3adea5cdac02bd5d1ff3
  41. 1
      test/core/client_config/uri_corpus/f6f3bd030f0d321efe7c51ca3f057de23509af67
  42. 2
      test/core/client_config/uri_corpus/f97598cff03306af3c70400608fec47268b5075d
  43. 1
      test/core/client_config/uri_corpus/f9e1ec1fc642b575bc9955618b7065747f56b101
  44. 1
      test/core/client_config/uri_corpus/fe0630a3aeed2ec6f474f362e4c839478290d5c4
  45. 1
      test/core/client_config/uri_corpus/ipv4.txt
  46. 1
      test/core/client_config/uri_corpus/ipv6.txt
  47. 1
      test/core/client_config/uri_corpus/unix.txt
  48. 52
      test/core/client_config/uri_fuzzer_test.c
  49. 2
      test/core/httpcli/corpus/0299ca2580e4398d170c4a336e0c33eb2cd9d427
  50. 2
      test/core/httpcli/corpus/05e613853d64a9669ea3cf41b0de777dc24931ba
  51. 2
      test/core/httpcli/corpus/069352518a1d1baa05f317c677d275cefda2ac97
  52. 4
      test/core/httpcli/corpus/0c5b7c2569410b526605e308309a7f36574e530d
  53. 3
      test/core/httpcli/corpus/0ef3d0a84360bb5ad66274f1226f5cb273ecdbcf
  54. 3
      test/core/httpcli/corpus/1e1273f90187fdf5df3625764245610f86af6aa4
  55. 2
      test/core/httpcli/corpus/33f4ea0c7ea27c37d8f95cfa64d282370efdafd2
  56. 2
      test/core/httpcli/corpus/35f0c561297cfc840ddaeebb9fc61091f4eadece
  57. 2
      test/core/httpcli/corpus/39b19c41ba537f37511eff7727733715db432e76
  58. 3
      test/core/httpcli/corpus/3e3c4756d5e40b5aa250954cbac86b826e70a7ac
  59. 2
      test/core/httpcli/corpus/3fb034e66ee5494a67acae1b4e6ff64ba92a2046
  60. 2
      test/core/httpcli/corpus/487725eb38511c79a9340bf4560a1411061fa6fa
  61. 2
      test/core/httpcli/corpus/4b1f1f79a0bfa3f942479dd5f8edb59a7c257c55
  62. 3
      test/core/httpcli/corpus/5028c56a5116a186b7343ff59567b47347a0796d
  63. 2
      test/core/httpcli/corpus/5b6292bdf009b0daecbc90b85cca30a88c36eec5
  64. 3
      test/core/httpcli/corpus/657368df512ca6294b9df16adf935a3f374a8be2
  65. 2
      test/core/httpcli/corpus/81f59a12b458ec3604035cb962165c604d1355e6
  66. 4
      test/core/httpcli/corpus/8f41c50e88ee8c17ecad3d41d63d38fb12aca0b9
  67. 3
      test/core/httpcli/corpus/97e4499d450c95660de86747f527e670f2012548
  68. 2
      test/core/httpcli/corpus/aa3bbb876eafa8ad8ca4ff2eabc6dd94341d2441
  69. 2
      test/core/httpcli/corpus/b04fea5c041c707db0ad9c09a81672557b52cc47
  70. 2
      test/core/httpcli/corpus/c55ce9995b002e88a102ae2891a71e8bacb346c8
  71. 3
      test/core/httpcli/corpus/ca5a0c00b8969310acb73d15ad0d0c602f1bd0c2
  72. 3
      test/core/httpcli/corpus/d4c3e4cf5d035596433c30eaabbd2b2925f4b453
  73. 2
      test/core/httpcli/corpus/d936dad71c129cf659097dc3db64550c4dd467f4
  74. 1
      test/core/httpcli/corpus/fc5d4b9117ba9e87388174aee4f4970bdfe8d066
  75. 4
      test/core/httpcli/corpus/response1.txt
  76. 50
      test/core/httpcli/fuzzer.c
  77. 1
      test/core/transport/chttp2/hpack_parser_corpus/0141fcddc9807ee093313b2256f1306fbbdc6cda
  78. BIN
      test/core/transport/chttp2/hpack_parser_corpus/06995c2f3f01c7ec50547415dc324c64030b7a3e
  79. 1
      test/core/transport/chttp2/hpack_parser_corpus/06f7ce769fe07804fc842462d4be8c1aa2ba82c2
  80. 1
      test/core/transport/chttp2/hpack_parser_corpus/0828169ba82152a8907f1001e3d98804397d4610
  81. BIN
      test/core/transport/chttp2/hpack_parser_corpus/0a10bd140c6c5fb109a0816ca061739688a6db9a
  82. BIN
      test/core/transport/chttp2/hpack_parser_corpus/0c9996d4fef87bacd7a001e99a515b3ba3d5788f
  83. 1
      test/core/transport/chttp2/hpack_parser_corpus/0d6210208831fe55951af56cdeee3d54a91a5361
  84. 1
      test/core/transport/chttp2/hpack_parser_corpus/0d784965b2262df7ed7a1eb57b92a718cc76bde8
  85. BIN
      test/core/transport/chttp2/hpack_parser_corpus/0e9196f951874edbb5ed098739ea5c8b6c0751c2
  86. BIN
      test/core/transport/chttp2/hpack_parser_corpus/1e8befb98cbaba059d6771abd1680e19484e7723
  87. 1
      test/core/transport/chttp2/hpack_parser_corpus/311dac5092e36134d3490f98aa4207425e0ee941
  88. 1
      test/core/transport/chttp2/hpack_parser_corpus/342ff1db70a7616b4ef76c03a42802c6702c18cb
  89. 1
      test/core/transport/chttp2/hpack_parser_corpus/38228bf98cdb50fd3fa830ba5a9d4c7399063dff
  90. 1
      test/core/transport/chttp2/hpack_parser_corpus/3a4bb427a85bdc5bf66ac71db073c99e0dc9f881
  91. 1
      test/core/transport/chttp2/hpack_parser_corpus/3aec8d9311130dfbb6584fe6e619579c21992b5f
  92. 1
      test/core/transport/chttp2/hpack_parser_corpus/3c5af4d73e94d0e8ad5666b6acb340f929031e95
  93. 1
      test/core/transport/chttp2/hpack_parser_corpus/3f8983e457033cc85997c356935ba9c21460e86b
  94. BIN
      test/core/transport/chttp2/hpack_parser_corpus/4256437fc5897c0cd5d755816e4e68c7be326849
  95. 1
      test/core/transport/chttp2/hpack_parser_corpus/471a307b81dc37459087d41532741c5c9d7ba836
  96. 1
      test/core/transport/chttp2/hpack_parser_corpus/48bcce2c6487b18706ef0c609ca39c456215bac8
  97. BIN
      test/core/transport/chttp2/hpack_parser_corpus/4c7a034d3a3b4f29d99caf021a0e9bbb89706c2e
  98. 1
      test/core/transport/chttp2/hpack_parser_corpus/50b3f4b6aed97f442496d27f3b4315a18ba76d5f
  99. 1
      test/core/transport/chttp2/hpack_parser_corpus/51eff6fcbfe1a51ceb3f5f2140c01eea89b4313d
  100. 1
      test/core/transport/chttp2/hpack_parser_corpus/5653c44a5b520bdf2bdc599b7966f1d7c44950b3
  101. Some files were not shown because too many files have changed in this diff Show More

@ -925,9 +925,11 @@ 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_security_connector_test: $(BINDIR)/$(CONFIG)/grpc_security_connector_test
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_table_test: $(BINDIR)/$(CONFIG)/hpack_table_test
httpcli_format_request_test: $(BINDIR)/$(CONFIG)/httpcli_format_request_test
httpcli_fuzzer_test: $(BINDIR)/$(CONFIG)/httpcli_fuzzer_test
httpcli_parser_test: $(BINDIR)/$(CONFIG)/httpcli_parser_test
httpcli_test: $(BINDIR)/$(CONFIG)/httpcli_test
httpscli_test: $(BINDIR)/$(CONFIG)/httpscli_test
@ -967,6 +969,7 @@ transport_connectivity_state_test: $(BINDIR)/$(CONFIG)/transport_connectivity_st
transport_metadata_test: $(BINDIR)/$(CONFIG)/transport_metadata_test
transport_security_test: $(BINDIR)/$(CONFIG)/transport_security_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
workqueue_test: $(BINDIR)/$(CONFIG)/workqueue_test
alarm_cpp_test: $(BINDIR)/$(CONFIG)/alarm_cpp_test
@ -7649,6 +7652,38 @@ 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 = \
test/core/transport/chttp2/hpack_parser_test.c \
@ -7745,6 +7780,38 @@ endif
endif
HTTPCLI_FUZZER_TEST_SRC = \
test/core/httpcli/fuzzer.c \
HTTPCLI_FUZZER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTPCLI_FUZZER_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/httpcli_fuzzer_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/httpcli_fuzzer_test: $(HTTPCLI_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) $(HTTPCLI_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)/httpcli_fuzzer_test
endif
$(OBJDIR)/$(CONFIG)/test/core/httpcli/fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_httpcli_fuzzer_test: $(HTTPCLI_FUZZER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(HTTPCLI_FUZZER_TEST_OBJS:.o=.dep)
endif
endif
HTTPCLI_PARSER_TEST_SRC = \
test/core/httpcli/parser_test.c \
@ -8993,6 +9060,38 @@ 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 = \
test/core/client_config/uri_parser_test.c \

@ -1532,6 +1532,18 @@ targets:
- grpc
- gpr_test_util
- 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
build: test
language: c
@ -1562,6 +1574,18 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: httpcli_fuzzer_test
build: fuzzer
language: c
src:
- test/core/httpcli/fuzzer.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- test/core/httpcli/corpus
- name: httpcli_parser_test
build: test
language: c
@ -1993,6 +2017,18 @@ targets:
- mac
- linux
- 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
build: test
language: c

@ -39,6 +39,8 @@
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
extern int grpc_http_trace;
static int handle_response_line(grpc_httpcli_parser *parser) {
uint8_t *beg = parser->cur_line;
uint8_t *cur = beg;
@ -65,7 +67,9 @@ static int handle_response_line(grpc_httpcli_parser *parser) {
return 1;
error:
gpr_log(GPR_ERROR, "Failed parsing response line");
if (grpc_http_trace) {
gpr_log(GPR_ERROR, "Failed parsing response line");
}
return 0;
}
@ -85,7 +89,9 @@ static int add_header(grpc_httpcli_parser *parser) {
GPR_ASSERT(cur != end);
if (*cur == ' ' || *cur == '\t') {
gpr_log(GPR_ERROR, "Continued header lines not supported yet");
if (grpc_http_trace) {
gpr_log(GPR_ERROR, "Continued header lines not supported yet");
}
goto error;
}
@ -93,7 +99,9 @@ static int add_header(grpc_httpcli_parser *parser) {
cur++;
}
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;
}
GPR_ASSERT(cur >= beg);

@ -34,9 +34,9 @@
#include "src/core/transport/chttp2/hpack_parser.h"
#include "src/core/transport/chttp2/internal.h"
#include <assert.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
/* This is here for grpc_is_binary_header
* TODO(murgatroid99): Remove this
@ -52,6 +52,8 @@
#include "src/core/support/string.h"
#include "src/core/transport/chttp2/bin_encoder.h"
extern int grpc_http_trace;
typedef enum {
NOT_BINARY,
B64_BYTE0,
@ -723,7 +725,9 @@ static int finish_indexed_field(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
const uint8_t *end) {
grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
if (md == NULL) {
gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
if (grpc_http_trace) {
gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
}
return 0;
}
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 */
static int finish_max_tbl_size(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
const uint8_t *end) {
gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
if (grpc_http_trace) {
gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
}
return grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index) &&
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,
const uint8_t *end) {
GPR_ASSERT(cur != end);
gpr_log(GPR_DEBUG, "Illegal hpack op code %d", *cur);
if (grpc_http_trace) {
gpr_log(GPR_DEBUG, "Illegal hpack op code %d", *cur);
}
return parse_error(p, cur, end);
}
@ -1069,10 +1077,12 @@ static int parse_value4(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
}
error:
gpr_log(GPR_ERROR,
"integer overflow in hpack integer decoding: have 0x%08x, "
"got byte 0x%02x on byte 5",
*p->parsing.value, *cur);
if (grpc_http_trace) {
gpr_log(GPR_ERROR,
"integer overflow in hpack integer decoding: have 0x%08x, "
"got byte 0x%02x on byte 5",
*p->parsing.value, *cur);
}
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);
}
gpr_log(GPR_ERROR,
"integer overflow in hpack integer decoding: have 0x%08x, "
"got byte 0x%02x sometime after byte 5",
*p->parsing.value, *cur);
if (grpc_http_trace) {
gpr_log(GPR_ERROR,
"integer overflow in hpack integer decoding: have 0x%08x, "
"got byte 0x%02x sometime after byte 5",
*p->parsing.value, *cur);
}
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) {
grpc_mdelem *elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
if (!elem) {
gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
if (grpc_http_trace) {
gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
}
return ERROR_HEADER;
}
return grpc_is_binary_header(

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

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

@ -0,0 +1,4 @@
HTTP/1.1 200 OKH
tHTHTTP/1. 20TP/01.020(: Oes,H0 OKH
tteses

@ -0,0 +1,3 @@
HJHTHHTT`TT
/1.1 201 P*HHTT/T1/OKH
des1.1 2.1T 20T1

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

@ -0,0 +1,4 @@
HTTP/1.1 200 OK
test: hello
abcd

@ -0,0 +1,50 @@
/*
*
* 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/httpcli/parser.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_httpcli_parser parser;
grpc_httpcli_parser_init(&parser);
gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size);
grpc_httpcli_parser_parse(&parser, slice);
grpc_httpcli_parser_eof(&parser);
gpr_slice_unref(slice);
grpc_httpcli_parser_destroy(&parser);
return 0;
}

@ -0,0 +1 @@
):;!śĘ'ŇŘ)*;}v)7IĎ!¤);–-M*±äâ!'d*Cu«‘X$0):ó*;:äÝ;;();:]ďć@

@ -0,0 +1 @@
*<EFBFBD><EFBFBD><EFBFBD>@:<EFBFBD>[(<EFBFBD>c (;<EFBFBD>!!\ !c<EFBFBD>G<EFBFBD>:

@ -0,0 +1 @@
¤ð[('! ð(!\ !åGý:(!'ð[(!! ¤[ð!ð cð[(!! !åGý!åGý'A)([( '!!å

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

Loading…
Cancel
Save