FSTFuzzTestSerializer.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef FIRESTORE_EXAMPLE_FUZZTESTS_FUZZINGTARGETS_FSTFUZZTESTSERIALIZER_H_
  17. #define FIRESTORE_EXAMPLE_FUZZTESTS_FUZZINGTARGETS_FSTFUZZTESTSERIALIZER_H_
  18. #import <Foundation/Foundation.h>
  19. namespace firebase {
  20. namespace firestore {
  21. namespace fuzzing {
  22. // Returns the location of the Serializer dictionary file.
  23. inline NSString *GetSerializerDictionaryLocation(NSString *resources_location) {
  24. return [resources_location stringByAppendingPathComponent:@"Serializer/serializer.dictionary"];
  25. }
  26. // Returns the location of the Serializer corpus. This corpus is a special
  27. // case because we generate its binary protos during the build process.
  28. inline NSString *GetSerializerCorpusLocation() {
  29. return @"FuzzTestsCorpus";
  30. }
  31. // Fuzz-test the deserialization process in Firestore. The Serializer reads raw
  32. // bytes and converts them to a model object.
  33. int FuzzTestDeserialization(const uint8_t *data, size_t size);
  34. } // namespace fuzzing
  35. } // namespace firestore
  36. } // namespace firebase
  37. #endif // FIRESTORE_EXAMPLE_FUZZTESTS_FUZZINGTARGETS_FSTFUZZTESTSERIALIZER_H_