cast_framer_serialize_fuzzer.cc 729 B

123456789101112131415161718192021222324
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include <cstdlib>
  5. #include <iostream>
  6. #include <string>
  7. #include "components/cast_channel/cast_framer.h"
  8. #include "testing/libfuzzer/proto/lpm_interface.h"
  9. #include "third_party/openscreen/src/cast/common/channel/proto/cast_channel.pb.h"
  10. namespace cast_channel {
  11. namespace fuzz {
  12. DEFINE_PROTO_FUZZER(const cast::channel::CastMessage& input) {
  13. std::string native_input;
  14. MessageFramer::Serialize(input, &native_input);
  15. if (::getenv("LPM_DUMP_NATIVE_INPUT"))
  16. std::cout << native_input << std::endl;
  17. }
  18. } // namespace fuzz
  19. } // namespace cast_channel