Commit Graph
11 Commits
Author SHA1 Message Date
Mina Farid d6075418fa Fuzz test internal method in FIRFieldPath (#1675) 2018-08-13 14:02:38 -04:00
rsgowman 786f7666f9 Refactor serializers (#1625)
* Use nanopb::Reader, Writer, in the serializer's public methods. This eliminates overloads that take raw bytes.
* Refactor the serializer's return values from Status, StatusOr<T> to void, optional<T> (or unique_ptr<T>) for encoding/decode methods, respectively.
* Errors during serializer encoding methods now fatal. Previously, we'd propagate the errors back to the caller, but there aren't any errors that could realistically be recovered from. So now we just abort(). (This is in contrast to *de*coding methods, which could generate errors that we might want to recover from.)
* Reduce early returns in the serializers
* Unify public/private method return values of the serializers. Now the private methods return void/optional, just like the public methods.
* Reader::ReadTag now tracks the last read tag. This allows:
  * RequireWireType to not need it as a parameter
  * SkipField to not need it as a parameter
  * ReadTag to be inlined into most switch statements
* Move RequireWireType into ReadX methods
* Reader::SkipField -> Reader::SkipUnknown
* Add ReadNestedMessage overload in order to accept non-static functions.
* Add a few using statements to simplify code. (Also keeps local serializer more in sync with the remote serializer.)
* Use nullopt/nullptr instead of {}
* Reader::update_status() -> Fail()
* Add DecodeSnapshotVersion
* Don't directly update status within nanopb::Reader. Instead, call Reader::Fail() (which calls Status::Update()). This ensures we don't accidentally overwrite the first error status with
a subsequent one.
2018-08-08 17:32:25 -04:00
Mina Farid 50dbc19456 Rename fuzz targets and use dictionary and corpus (#1628)
* Rename fuzz targets and use dictionary and corpus
* Added a comment about naming
2018-08-03 16:12:05 -04:00
Mina Farid 31f6f804c5 Added fuzz testing target: FIRFieldPath (#1575)
* Added `FIELDPATH` to the list of available fuzzing targets.
* Added fuzzing method for creating `FIRFieldPath` objects.
* Added corpus and dictionary for `FIRFieldPath`.
2018-07-27 15:25:13 -04:00
Mina Farid 143c36c232 Fuzz testing refactoring (#1563)
* Added fuzzing targets read from env variable.
* Refactored Serializer fuzz tests in a separate file
* Separate header file for each fuzzing target.
* Write crashing outputs using `artifact_prefix` flag to `NSTemporaryDirectory`.
2018-07-23 09:55:32 -04:00
Mina Farid ab8ec2d725 Multiple fuzz testing targets (#1550)
* Read fuzzing target `FUZZING_TARGET` environment variable.
2018-07-19 17:02:02 -04:00
Mina Farid 22562f49eb Fuzz testing uses protoc from a pod dependency (#1538) 2018-07-16 13:55:10 -04:00
Mina Farid 730780faf4 Fuzz testing Serializer with a dictionary and corpus (#1513)
Added functionality to read dictionary file and seed input corpus from bundle
2018-07-13 15:02:48 -04:00
Mina Farid 37edbc694d Fuzz test Serializer to decode FieldValue (#1485) 2018-07-03 13:40:50 -04:00
Mina Farid f5bf0a37a7 Fuzz testing Header Search Paths settings (#1395)
* Modified `HEADER_SEARCH_PATHS` in the project file.
2018-06-11 17:23:07 -04:00
Mina Farid a135ee1717 Add a new Xcode target and scheme for fuzz tests (#1364)
Created `Firestore_FuzzTests_iOS` Xcode target as a duplicate of the target
  `Firestore_Tests_iOS`.
    - Added `-fsanitize-coverage=trace-pc-guard` to the compiler flags to enable
      code coverage by libFuzzer fuzzing driver.
    - Modified the files to compile to the fuzz testing ones.
    - Added a Principal testing class.
* Modified the `Podfile` to include `LibFuzzer.podspec` as a dependency for
  the target `Firestore_FuzzTests_iOS`.
* Added a skeleton for fuzz testing. Currently does not test any code but
  the fuzzing works fine and calls an empty `LLVMFuzzerTestOneInput`
  with different input values.
    - This means that fuzzing does not finish or crash.
2018-06-04 14:36:55 -04:00