aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore
diff options
context:
space:
mode:
authorGravatar Mina Farid <minafarid@google.com>2018-06-11 17:23:07 -0400
committerGravatar GitHub <noreply@github.com>2018-06-11 17:23:07 -0400
commitf5bf0a37a7dd40e7538a1aed77af05471b7fe713 (patch)
treeabb9578990d971d93eb399106bcb8f2d586f7ec4 /Firestore
parent6e6462e865e5202868f3478c73a72b082e05b205 (diff)
Fuzz testing Header Search Paths settings (#1395)
* Modified `HEADER_SEARCH_PATHS` in the project file.
Diffstat (limited to 'Firestore')
-rw-r--r--Firestore/Example/Firestore.xcodeproj/project.pbxproj12
-rw-r--r--Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_FuzzTests_iOS.xcscheme13
-rw-r--r--Firestore/Example/FuzzTests/FSTFuzzTestsPrincipal.mm14
3 files changed, 24 insertions, 15 deletions
diff --git a/Firestore/Example/Firestore.xcodeproj/project.pbxproj b/Firestore/Example/Firestore.xcodeproj/project.pbxproj
index 0ce2716..11cabc4 100644
--- a/Firestore/Example/Firestore.xcodeproj/project.pbxproj
+++ b/Firestore/Example/Firestore.xcodeproj/project.pbxproj
@@ -2093,6 +2093,12 @@
"COCOAPODS=1",
"GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1",
);
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"${PODS_ROOT}/../../..\"",
+ "\"${PODS_ROOT}/../../../Firestore/third_party/abseil-cpp\"",
+ "\"${PODS_ROOT}/nanopb\"",
+ );
INFOPLIST_FILE = "FuzzTests/Firestore_FuzzTests_iOS-Info.plist";
OTHER_CFLAGS = (
"$(inherited)",
@@ -2123,6 +2129,12 @@
"COCOAPODS=1",
"GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1",
);
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"${PODS_ROOT}/../../..\"",
+ "\"${PODS_ROOT}/../../../Firestore/third_party/abseil-cpp\"",
+ "\"${PODS_ROOT}/nanopb\"",
+ );
INFOPLIST_FILE = "FuzzTests/Firestore_FuzzTests_iOS-Info.plist";
OTHER_CFLAGS = (
"$(inherited)",
diff --git a/Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_FuzzTests_iOS.xcscheme b/Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_FuzzTests_iOS.xcscheme
index 051b1a4..039273b 100644
--- a/Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_FuzzTests_iOS.xcscheme
+++ b/Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_FuzzTests_iOS.xcscheme
@@ -5,19 +5,6 @@
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
- <BuildActionEntries>
- <BuildActionEntry
- buildForRunning = "YES"
- buildForTesting = "YES">
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "6EDD3AD120BF247500C33877"
- BuildableName = "Firestore_FuzzTests_iOS.xctest"
- BlueprintName = "Firestore_FuzzTests_iOS"
- ReferencedContainer = "container:Firestore.xcodeproj">
- </BuildableReference>
- </BuildActionEntry>
- </BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
diff --git a/Firestore/Example/FuzzTests/FSTFuzzTestsPrincipal.mm b/Firestore/Example/FuzzTests/FSTFuzzTestsPrincipal.mm
index 63f6db0..038e687 100644
--- a/Firestore/Example/FuzzTests/FSTFuzzTestsPrincipal.mm
+++ b/Firestore/Example/FuzzTests/FSTFuzzTestsPrincipal.mm
@@ -18,12 +18,22 @@
#include "LibFuzzer/FuzzerDefs.h"
+#include "Firestore/core/src/firebase/firestore/remote/serializer.h"
+
+using firebase::firestore::remote::Serializer;
+
namespace {
+// Fuzz-test the deserialization process in Firestore. The Serializer reads raw
+// bytes and converts them to a model object.
+void FuzzTestDeserialization(const uint8_t *data, size_t size) {
+ // TODO(minafarid): fuzz-test Serializer.
+}
+
// Contains the code to be fuzzed. Called by the fuzzing library with
// different argument values for `data` and `size`.
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- // Code to be fuzz-tested here.
+ FuzzTestDeserialization(data, size);
return 0;
}
@@ -32,7 +42,7 @@ int RunFuzzTestingMain() {
// Arguments to libFuzzer main() function should be added to this array,
// e.g., dictionaries, corpus, number of runs, jobs, etc.
char *program_args[] = {
- const_cast<char *>("RunFuzzTestingMain") // First argument is program name.
+ const_cast<char *>("RunFuzzTestingMain") // First arg is program name.
};
char **argv = program_args;
int argc = sizeof(program_args) / sizeof(program_args[0]);