diff --git a/examples/peerconnection/client/conductor.cc b/examples/peerconnection/client/conductor.cc index 7edf83872b..1fdf84891d 100644 --- a/examples/peerconnection/client/conductor.cc +++ b/examples/peerconnection/client/conductor.cc @@ -318,9 +318,12 @@ void Conductor::OnMessageFromPeer(int peer_id, const std::string& message) { return; } - Json::Reader reader; + Json::CharReaderBuilder factory; + std::unique_ptr reader = + absl::WrapUnique(factory.newCharReader()); Json::Value jmessage; - if (!reader.parse(message, jmessage)) { + if (!reader->parse(message.data(), message.data() + message.length(), + &jmessage, nullptr)) { RTC_LOG(LS_WARNING) << "Received unknown message. " << message; return; } diff --git a/test/fuzzers/utils/BUILD.gn b/test/fuzzers/utils/BUILD.gn index 7ed8a379da..12e94be2db 100644 --- a/test/fuzzers/utils/BUILD.gn +++ b/test/fuzzers/utils/BUILD.gn @@ -43,4 +43,5 @@ rtc_library("rtp_replayer") { "../../../test:test_support", "../../../test:video_test_common", ] + absl_deps = [ "//third_party/abseil-cpp/absl/memory:memory" ] } diff --git a/test/fuzzers/utils/rtp_replayer.cc b/test/fuzzers/utils/rtp_replayer.cc index 43b1fc2ea4..3b393ab16f 100644 --- a/test/fuzzers/utils/rtp_replayer.cc +++ b/test/fuzzers/utils/rtp_replayer.cc @@ -15,6 +15,7 @@ #include #include +#include "absl/memory/memory.h" #include "api/task_queue/default_task_queue_factory.h" #include "api/transport/field_trial_based_config.h" #include "modules/rtp_rtcp/source/rtp_packet.h" @@ -85,12 +86,16 @@ void RtpReplayer::Replay( std::vector RtpReplayer::ReadConfigFromFile( const std::string& replay_config, Transport* transport) { - Json::Reader json_reader; + Json::CharReaderBuilder factory; + std::unique_ptr json_reader = + absl::WrapUnique(factory.newCharReader()); Json::Value json_configs; - if (!json_reader.parse(replay_config, json_configs)) { + Json::String errors; + if (!json_reader->parse(replay_config.data(), + replay_config.data() + replay_config.length(), + &json_configs, &errors)) { RTC_LOG(LS_ERROR) - << "Error parsing JSON replay configuration for the fuzzer" - << json_reader.getFormatedErrorMessages(); + << "Error parsing JSON replay configuration for the fuzzer: " << errors; return {}; }