aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com>2018-06-21 22:05:47 -0700
committerGravatar Gunhan Gulsoy <gunan@google.com>2018-06-21 22:05:46 -0700
commitd932155363d6ded97dda38ce799168d27566978b (patch)
tree3221394d7a0a3c266106289e179f1d77966c2f47
parentb302b73c4d0fbca4fcc015ab86040e21dd697bd4 (diff)
Update jsoncpp to 1.8.4 (#20182)
* Update jsoncpp to 1.8.4 This fix updates the jsoncpp to 1.8.4 to address the issue raised in 20170. The jsoncpp used in tf was old and may contain security issues. This fix fixes 20170. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Add JSON_HAS_INT64 define to jsoncpp build Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix data type conversion issue for jsoncpp. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix build by include "version.h" Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
-rw-r--r--tensorflow/core/platform/cloud/oauth_client.cc4
-rw-r--r--tensorflow/core/profiler/internal/tfprof_timeline.cc16
-rw-r--r--tensorflow/workspace.bzl8
-rw-r--r--third_party/jsoncpp.BUILD7
4 files changed, 19 insertions, 16 deletions
diff --git a/tensorflow/core/platform/cloud/oauth_client.cc b/tensorflow/core/platform/cloud/oauth_client.cc
index e64653a67a..ee6ba7b041 100644
--- a/tensorflow/core/platform/cloud/oauth_client.cc
+++ b/tensorflow/core/platform/cloud/oauth_client.cc
@@ -137,8 +137,8 @@ Status EncodeJwtClaim(StringPiece client_email, StringPiece scope,
const auto expiration_timestamp_sec =
request_timestamp_sec + kRequestedTokenLifetimeSec;
- root["iat"] = request_timestamp_sec;
- root["exp"] = expiration_timestamp_sec;
+ root["iat"] = Json::Value::UInt64(request_timestamp_sec);
+ root["exp"] = Json::Value::UInt64(expiration_timestamp_sec);
// Step 2: represent the JSON as a string.
string claim = root.toStyledString();
diff --git a/tensorflow/core/profiler/internal/tfprof_timeline.cc b/tensorflow/core/profiler/internal/tfprof_timeline.cc
index b0dd8ce5e0..979b437914 100644
--- a/tensorflow/core/profiler/internal/tfprof_timeline.cc
+++ b/tensorflow/core/profiler/internal/tfprof_timeline.cc
@@ -47,9 +47,9 @@ Json::Value ChromeTraceFormatter::CreateEvent(const string& ph,
event["ph"] = Json::Value(ph);
event["cat"] = Json::Value(category);
event["name"] = Json::Value(name);
- event["pid"] = Json::Value(pid);
- event["tid"] = Json::Value(tid);
- event["ts"] = Json::Value(ts);
+ event["pid"] = Json::Int64(pid);
+ event["tid"] = Json::Int64(tid);
+ event["ts"] = Json::Int64(ts);
return event;
}
@@ -57,7 +57,7 @@ void ChromeTraceFormatter::EmitPID(const string& name, int64 pid) {
Json::Value event(Json::objectValue);
event["name"] = Json::Value("process_name");
event["ph"] = Json::Value("M");
- event["pid"] = Json::Value(pid);
+ event["pid"] = Json::Int64(pid);
Json::Value args(Json::objectValue);
args["name"] = Json::Value(name);
event["args"] = args;
@@ -68,7 +68,7 @@ void ChromeTraceFormatter::EmitRegion(int64 ts, int64 duration, int64 pid,
int64 tid, const string& category,
const string& name, Json::Value args) {
Json::Value event = CreateEvent("X", category, name, pid, tid, ts);
- event["dur"] = Json::Value(duration);
+ event["dur"] = Json::Int64(duration);
event["args"] = std::move(args);
metadata_.push_back(event);
}
@@ -76,14 +76,14 @@ void ChromeTraceFormatter::EmitRegion(int64 ts, int64 duration, int64 pid,
void ChromeTraceFormatter::EmitFlowStart(const string& name, int64 ts,
int64 pid, int64 tid, int64 flow_id) {
Json::Value event = CreateEvent("s", "DataFlow", name, pid, tid, ts);
- event["id"] = flow_id;
+ event["id"] = Json::Int64(flow_id);
events_.push_back(event);
}
void ChromeTraceFormatter::EmitFlowEnd(const string& name, int64 ts, int64 pid,
int64 tid, int64 flow_id) {
Json::Value event = CreateEvent("t", "DataFlow", name, pid, tid, ts);
- event["id"] = flow_id;
+ event["id"] = Json::Int64(flow_id);
events_.push_back(event);
}
@@ -93,7 +93,7 @@ void ChromeTraceFormatter::EmitCounter(
const std::map<int64, std::vector<string>>& tensor_mem) {
Json::Value event = CreateEvent("C", category, "Allocated Bytes", pid, 0, ts);
Json::Value args(Json::objectValue);
- args["Allocator Bytes in Use"] = Json::Value(bytes);
+ args["Allocator Bytes in Use"] = Json::Int64(bytes);
event["args"] = args;
events_.push_back(event);
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 5ed9d05c8b..973dccc1ea 100644
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -474,11 +474,11 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
tf_http_archive(
name = "jsoncpp_git",
urls = [
- "https://mirror.bazel.build/github.com/open-source-parsers/jsoncpp/archive/11086dd6a7eba04289944367ca82cea71299ed70.tar.gz",
- "https://github.com/open-source-parsers/jsoncpp/archive/11086dd6a7eba04289944367ca82cea71299ed70.tar.gz",
+ "https://mirror.bazel.build/github.com/open-source-parsers/jsoncpp/archive/1.8.4.tar.gz",
+ "https://github.com/open-source-parsers/jsoncpp/archive/1.8.4.tar.gz",
],
- sha256 = "07d34db40593d257324ec5fb9debc4dc33f29f8fb44e33a2eeb35503e61d0fe2",
- strip_prefix = "jsoncpp-11086dd6a7eba04289944367ca82cea71299ed70",
+ sha256 = "c49deac9e0933bcb7044f08516861a2d560988540b23de2ac1ad443b219afdb6",
+ strip_prefix = "jsoncpp-1.8.4",
build_file = clean_dep("//third_party:jsoncpp.BUILD"),
)
diff --git a/third_party/jsoncpp.BUILD b/third_party/jsoncpp.BUILD
index 65f98410b2..cf3cba0555 100644
--- a/third_party/jsoncpp.BUILD
+++ b/third_party/jsoncpp.BUILD
@@ -6,7 +6,6 @@ cc_library(
name = "jsoncpp",
srcs = [
"include/json/assertions.h",
- "src/lib_json/json_batchallocator.h",
"src/lib_json/json_reader.cpp",
"src/lib_json/json_tool.h",
"src/lib_json/json_value.cpp",
@@ -20,9 +19,13 @@ cc_library(
"include/json/json.h",
"include/json/reader.h",
"include/json/value.h",
+ "include/json/version.h",
"include/json/writer.h",
],
- copts = ["-DJSON_USE_EXCEPTION=0"],
+ copts = [
+ "-DJSON_USE_EXCEPTION=0",
+ "-DJSON_HAS_INT64",
+ ],
includes = ["include"],
visibility = ["//visibility:public"],
deps = [":private"],