[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Dec 21 02:53:07 UTC 2016


 test/fuzzing/Makefile.am  |    3 ++-
 test/fuzzing/hb-fuzzer.cc |   30 ++++--------------------------
 2 files changed, 6 insertions(+), 27 deletions(-)

New commits:
commit a0688e8e7b58c156f5809c272b5884bfe75f68ae
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Dec 20 20:52:50 2016 -0600

    Ouch, finish previous change

diff --git a/test/fuzzing/Makefile.am b/test/fuzzing/Makefile.am
index 7b0eb94..3ea8605 100644
--- a/test/fuzzing/Makefile.am
+++ b/test/fuzzing/Makefile.am
@@ -30,14 +30,15 @@ LDADD = \
 	$(NULL)
 
 hb_fuzzer_SOURCES = \
+	hb-fuzzer.hh \
 	hb-fuzzer.cc \
+	main.cc \
 	$(NULL)
 hb_fuzzer_LDADD = \
 	$(LDADD) \
 	$(NULL)
 hb_fuzzer_CPPFLAGS = \
 	$(AM_CPPFLAGS) \
-	-DMAIN \
 	$(NULL)
 hb_fuzzer_DEPENDENCIES = \
 	lib \
diff --git a/test/fuzzing/hb-fuzzer.cc b/test/fuzzing/hb-fuzzer.cc
index c9f15d8..79f3222 100644
--- a/test/fuzzing/hb-fuzzer.cc
+++ b/test/fuzzing/hb-fuzzer.cc
@@ -1,10 +1,10 @@
-#include <stddef.h>
-#include <hb.h>
+#include "hb-fuzzer.hh"
+
 #include <hb-ot.h>
 #include <string.h>
 
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
-
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
   hb_blob_t *blob = hb_blob_create((const char *)data, size,
                                    HB_MEMORY_MODE_READONLY, NULL, NULL);
   hb_face_t *face = hb_face_create(blob, 0);
@@ -50,25 +50,3 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   hb_blob_destroy(blob);
   return 0;
 }
-
-#ifdef MAIN
-#include <iostream>
-#include <iterator>
-#include <fstream>
-#include <assert.h>
-
-std::string FileToString(const std::string &Path) {
-  /* TODO This silently passes if file does not exist.  Fix it! */
-  std::ifstream T(Path.c_str());
-  return std::string((std::istreambuf_iterator<char>(T)),
-                     std::istreambuf_iterator<char>());
-}
-
-int main(int argc, char **argv) {
-  for (int i = 1; i < argc; i++) {
-    std::string s = FileToString(argv[i]);
-    std::cout << argv[i] << std::endl;
-    LLVMFuzzerTestOneInput((const unsigned char*)s.data(), s.size());
-  }
-}
-#endif


More information about the HarfBuzz mailing list