FSTFuzzTestSerializer.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #include <string>
  20. namespace firebase {
  21. namespace firestore {
  22. namespace fuzzing {
  23. // Returns the location of the Serializer dictionary file.
  24. inline std::string GetSerializerDictionaryLocation(std::string resources_location) {
  25. return resources_location + "/Serializer/serializer.dictionary";
  26. }
  27. // Returns the location of the Serializer corpus. This corpus is a special
  28. // case because we generate its binary protos during the build process.
  29. inline std::string GetSerializerCorpusLocation() {
  30. return "FuzzTestsCorpus";
  31. }
  32. // Fuzz-test the deserialization process in Firestore. The Serializer reads raw
  33. // bytes and converts them to a model object.
  34. int FuzzTestDeserialization(const uint8_t *data, size_t size);
  35. } // namespace fuzzing
  36. } // namespace firestore
  37. } // namespace firebase
  38. #endif // FIRESTORE_EXAMPLE_FUZZTESTS_FUZZINGTARGETS_FSTFUZZTESTSERIALIZER_H_