Merge fixes

pull/5846/head
Craig Tiller 9 years ago
parent 2a712736fe
commit 2123974071
  1. 71
      Makefile
  2. 24
      build.yaml
  3. 0
      test/core/http/corpus/0299ca2580e4398d170c4a336e0c33eb2cd9d427
  4. 0
      test/core/http/corpus/05e613853d64a9669ea3cf41b0de777dc24931ba
  5. 0
      test/core/http/corpus/069352518a1d1baa05f317c677d275cefda2ac97
  6. 0
      test/core/http/corpus/0c5b7c2569410b526605e308309a7f36574e530d
  7. 0
      test/core/http/corpus/0ef3d0a84360bb5ad66274f1226f5cb273ecdbcf
  8. 0
      test/core/http/corpus/1e1273f90187fdf5df3625764245610f86af6aa4
  9. 0
      test/core/http/corpus/33f4ea0c7ea27c37d8f95cfa64d282370efdafd2
  10. 0
      test/core/http/corpus/35f0c561297cfc840ddaeebb9fc61091f4eadece
  11. 0
      test/core/http/corpus/39b19c41ba537f37511eff7727733715db432e76
  12. 0
      test/core/http/corpus/3e3c4756d5e40b5aa250954cbac86b826e70a7ac
  13. 0
      test/core/http/corpus/3fb034e66ee5494a67acae1b4e6ff64ba92a2046
  14. 0
      test/core/http/corpus/487725eb38511c79a9340bf4560a1411061fa6fa
  15. 0
      test/core/http/corpus/4b1f1f79a0bfa3f942479dd5f8edb59a7c257c55
  16. 0
      test/core/http/corpus/5028c56a5116a186b7343ff59567b47347a0796d
  17. 0
      test/core/http/corpus/5b6292bdf009b0daecbc90b85cca30a88c36eec5
  18. 0
      test/core/http/corpus/657368df512ca6294b9df16adf935a3f374a8be2
  19. 0
      test/core/http/corpus/81f59a12b458ec3604035cb962165c604d1355e6
  20. 0
      test/core/http/corpus/8f41c50e88ee8c17ecad3d41d63d38fb12aca0b9
  21. 0
      test/core/http/corpus/97e4499d450c95660de86747f527e670f2012548
  22. 0
      test/core/http/corpus/aa3bbb876eafa8ad8ca4ff2eabc6dd94341d2441
  23. 0
      test/core/http/corpus/b04fea5c041c707db0ad9c09a81672557b52cc47
  24. 0
      test/core/http/corpus/c55ce9995b002e88a102ae2891a71e8bacb346c8
  25. 0
      test/core/http/corpus/ca5a0c00b8969310acb73d15ad0d0c602f1bd0c2
  26. 0
      test/core/http/corpus/d4c3e4cf5d035596433c30eaabbd2b2925f4b453
  27. 0
      test/core/http/corpus/d936dad71c129cf659097dc3db64550c4dd467f4
  28. 0
      test/core/http/corpus/fc5d4b9117ba9e87388174aee4f4970bdfe8d066
  29. 0
      test/core/http/corpus/request1.txt
  30. 0
      test/core/http/corpus/response1.txt
  31. 12
      test/core/http/fuzzer.c
  32. 50
      test/core/http/response_fuzzer.c
  33. 2
      tools/fuzzer/runners/http_fuzzer_test.sh
  34. 32
      tools/fuzzer/runners/http_response_fuzzer_test.sh
  35. 24
      tools/run_tests/sources_and_headers.json

@ -928,9 +928,8 @@ grpc_verify_jwt: $(BINDIR)/$(CONFIG)/grpc_verify_jwt
hpack_parser_fuzzer_test: $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test 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
http_request_fuzzer_test: $(BINDIR)/$(CONFIG)/http_request_fuzzer_test
http_response_fuzzer_test: $(BINDIR)/$(CONFIG)/http_response_fuzzer_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
@ -7798,98 +7797,66 @@ endif
endif endif
HTTP_PARSER_TEST_SRC = \ HTTP_FUZZER_TEST_SRC = \
test/core/http/parser_test.c \ test/core/http/fuzzer.c \
HTTP_PARSER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_PARSER_TEST_SRC)))) HTTP_FUZZER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_FUZZER_TEST_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL. # You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/http_parser_test: openssl_dep_error $(BINDIR)/$(CONFIG)/http_fuzzer_test: openssl_dep_error
else else
$(BINDIR)/$(CONFIG)/http_parser_test: $(HTTP_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(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 $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(HTTP_PARSER_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) -o $(BINDIR)/$(CONFIG)/http_parser_test $(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 endif
$(OBJDIR)/$(CONFIG)/test/core/http/parser_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(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_parser_test: $(HTTP_PARSER_TEST_OBJS:.o=.dep) deps_http_fuzzer_test: $(HTTP_FUZZER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true) ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true) ifneq ($(NO_DEPS),true)
-include $(HTTP_PARSER_TEST_OBJS:.o=.dep) -include $(HTTP_FUZZER_TEST_OBJS:.o=.dep)
endif endif
endif endif
HTTP_REQUEST_FUZZER_TEST_SRC = \ HTTP_PARSER_TEST_SRC = \
test/core/http/request_fuzzer.c \ test/core/http/parser_test.c \
HTTP_REQUEST_FUZZER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_REQUEST_FUZZER_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/http_request_fuzzer_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/http_request_fuzzer_test: $(HTTP_REQUEST_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_REQUEST_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_request_fuzzer_test
endif
$(OBJDIR)/$(CONFIG)/test/core/http/request_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_http_request_fuzzer_test: $(HTTP_REQUEST_FUZZER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(HTTP_REQUEST_FUZZER_TEST_OBJS:.o=.dep)
endif
endif
HTTP_RESPONSE_FUZZER_TEST_SRC = \
test/core/http/response_fuzzer.c \
HTTP_RESPONSE_FUZZER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_RESPONSE_FUZZER_TEST_SRC)))) HTTP_PARSER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_PARSER_TEST_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL. # You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/http_response_fuzzer_test: openssl_dep_error $(BINDIR)/$(CONFIG)/http_parser_test: openssl_dep_error
else else
$(BINDIR)/$(CONFIG)/http_response_fuzzer_test: $(HTTP_RESPONSE_FUZZER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/http_parser_test: $(HTTP_PARSER_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 $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(HTTP_RESPONSE_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_response_fuzzer_test $(Q) $(LD) $(LDFLAGS) $(HTTP_PARSER_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) -o $(BINDIR)/$(CONFIG)/http_parser_test
endif endif
$(OBJDIR)/$(CONFIG)/test/core/http/response_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/http/parser_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_http_response_fuzzer_test: $(HTTP_RESPONSE_FUZZER_TEST_OBJS:.o=.dep) deps_http_parser_test: $(HTTP_PARSER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true) ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true) ifneq ($(NO_DEPS),true)
-include $(HTTP_RESPONSE_FUZZER_TEST_OBJS:.o=.dep) -include $(HTTP_PARSER_TEST_OBJS:.o=.dep)
endif endif
endif endif

@ -1575,40 +1575,28 @@ targets:
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
- name: http_parser_test - name: http_fuzzer_test
build: test
language: c
src:
- test/core/http/parser_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: http_request_fuzzer_test
build: fuzzer build: fuzzer
language: c language: c
src: src:
- test/core/http/request_fuzzer.c - test/core/http/fuzzer.c
deps: deps:
- grpc_test_util - grpc_test_util
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
corpus_dirs: corpus_dirs:
- test/core/http/request_corpus - test/core/http/corpus
- name: http_response_fuzzer_test - name: http_parser_test
build: fuzzer build: test
language: c language: c
src: src:
- test/core/http/response_fuzzer.c - test/core/http/parser_test.c
deps: deps:
- grpc_test_util - grpc_test_util
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
corpus_dirs:
- test/core/http/response_corpus
- name: httpcli_format_request_test - name: httpcli_format_request_test
build: test build: test
language: c language: c

@ -36,15 +36,15 @@
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include "src/core/httpcli/parser.h" #include "src/core/http/parser.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_httpcli_parser parser; grpc_http_parser parser;
grpc_httpcli_parser_init(&parser); grpc_http_parser_init(&parser);
gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size); gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size);
grpc_httpcli_parser_parse(&parser, slice); grpc_http_parser_parse(&parser, slice);
grpc_httpcli_parser_eof(&parser); grpc_http_parser_eof(&parser);
gpr_slice_unref(slice); gpr_slice_unref(slice);
grpc_httpcli_parser_destroy(&parser); grpc_http_parser_destroy(&parser);
return 0; return 0;
} }

@ -1,50 +0,0 @@
/*
*
* 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;
}

@ -29,4 +29,4 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
bins/$config/http_request_fuzzer_test -max_total_time=60 fuzzer_output test/core/http/request_corpus bins/$config/http_fuzzer_test -max_total_time=60 fuzzer_output test/core/http/corpus

@ -1,32 +0,0 @@
#!/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.
#
bins/$config/http_response_fuzzer_test -max_total_time=60 fuzzer_output test/core/http/response_corpus

@ -939,25 +939,9 @@
], ],
"headers": [], "headers": [],
"language": "c", "language": "c",
"name": "http_parser_test", "name": "http_fuzzer_test",
"src": [
"test/core/http/parser_test.c"
],
"third_party": false,
"type": "target"
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "http_request_fuzzer_test",
"src": [ "src": [
"test/core/http/request_fuzzer.c" "test/core/http/fuzzer.c"
], ],
"third_party": false, "third_party": false,
"type": "target" "type": "target"
@ -971,9 +955,9 @@
], ],
"headers": [], "headers": [],
"language": "c", "language": "c",
"name": "http_response_fuzzer_test", "name": "http_parser_test",
"src": [ "src": [
"test/core/http/response_fuzzer.c" "test/core/http/parser_test.c"
], ],
"third_party": false, "third_party": false,
"type": "target" "type": "target"

Loading…
Cancel
Save