File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Firestore/Example/FuzzTests Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 18
18
19
19
#include " LibFuzzer/FuzzerDefs.h"
20
20
21
+ #include " Firestore/core/src/firebase/firestore/model/database_id.h"
21
22
#include " Firestore/core/src/firebase/firestore/remote/serializer.h"
22
23
24
+ using firebase::firestore::model::DatabaseId;
23
25
using firebase::firestore::remote::Serializer;
24
26
25
27
namespace {
26
28
27
29
// Fuzz-test the deserialization process in Firestore. The Serializer reads raw
28
30
// bytes and converts them to a model object.
29
31
void FuzzTestDeserialization (const uint8_t *data, size_t size) {
30
- // TODO(minafarid): fuzz-test Serializer.
32
+ DatabaseId database_id{" project" , DatabaseId::kDefault };
33
+ Serializer serializer{database_id};
34
+
35
+ @try {
36
+ serializer.DecodeFieldValue (data, size);
37
+ } @catch (...) {
38
+ // Caught exceptions are ignored because the input might be malformed and
39
+ // the deserialization might throw an error as intended. Fuzzing focuses on
40
+ // runtime errors that are detected by the sanitizers.
41
+ }
31
42
}
32
43
33
44
// Contains the code to be fuzzed. Called by the fuzzing library with
You can’t perform that action at this time.
0 commit comments