Merge pull request #186 from Google-Autofuzz/master

Add Fuzz target and modified BUILD
pull/13171/head
Joshua Haberman 6 years ago committed by GitHub
commit 6ce5e722f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      BUILD
  2. 16
      tests/file_descriptor_parsenew_fuzzer.cc

14
BUILD

@ -356,6 +356,20 @@ cc_test(
], ],
) )
# OSS-Fuzz test
cc_binary(
name = "file_descriptor_parsenew_fuzzer",
srcs = ["tests/file_descriptor_parsenew_fuzzer.cc"],
copts = CPPOTS + ["-fsanitizer=fuzzer,address"],
deps = [
":descriptor_upbproto",
":descriptor_upbreflection",
":upb",
":upb_pb",
":upb_test",
],
)
# copybara:strip_for_google3_begin # copybara:strip_for_google3_begin
upb_proto_reflection_library( upb_proto_reflection_library(
name = "descriptor_upbreflection", name = "descriptor_upbreflection",

@ -0,0 +1,16 @@
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include "google/protobuf/descriptor.upb.h"
#include "upb/def.h"
#include "upb/msg.h"
#include "upb/upb.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
upb_strview strview =
upb_strview_make(reinterpret_cast<const char*>(data), size);
upb::Arena arena;
google_protobuf_FileDescriptorProto_parsenew(strview, arena.ptr());
return 0;
}
Loading…
Cancel
Save