代码拉取完成,页面将自动刷新
同步操作将从 openEuler-RISC-V/tensorflow 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 532f5c5a547126c634fefd43bbad1dc6417678ac Mon Sep 17 00:00:00 2001
From: Mihai Maruseac <mihaimaruseac@google.com>
Date: Thu, 29 Jul 2021 22:24:39 -0700
Subject: [PATCH] Prevent nullptr deref in validation of indexes in map ops.
PiperOrigin-RevId: 387738023
Change-Id: I83d18d36a7b82ffd2a40b5124a4e5b4c72238f27
---
tensorflow/core/kernels/map_stage_op.cc | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tensorflow/core/kernels/map_stage_op.cc b/tensorflow/core/kernels/map_stage_op.cc
index 9411792762baa..1a2f5a8fa2247 100644
--- a/tensorflow/core/kernels/map_stage_op.cc
+++ b/tensorflow/core/kernels/map_stage_op.cc
@@ -210,9 +210,9 @@ class StagingMap : public ResourceBase {
const OptionalTuple& tuple)
TF_EXCLUSIVE_LOCKS_REQUIRED(mu_) {
if (tuple[index].has_value()) {
- return Status(errors::InvalidArgument(
+ return errors::InvalidArgument(
"The tensor for index '", index, "' for key '", key.scalar<int64>()(),
- "' was already initialized '", dtypes_.size(), "'."));
+ "' was already initialized '", dtypes_.size(), "'.");
}
return Status::OK();
@@ -220,6 +220,10 @@ class StagingMap : public ResourceBase {
// Check that the indices are strictly ordered
Status check_index_ordering(const Tensor& indices) {
+ if (indices.NumElements() == 0) {
+ return errors::InvalidArgument("Indices are empty");
+ }
+
auto findices = indices.flat<int>();
for (std::size_t i = 0; i < findices.dimension(0) - 1; ++i) {
@@ -227,8 +231,7 @@ class StagingMap : public ResourceBase {
continue;
}
- return Status(
- errors::InvalidArgument("Indices are not strictly ordered"));
+ return errors::InvalidArgument("Indices are not strictly ordered");
}
return Status::OK();
@@ -238,10 +241,10 @@ class StagingMap : public ResourceBase {
Status check_memory_limit(std::size_t bytes)
TF_EXCLUSIVE_LOCKS_REQUIRED(mu_) {
if (has_memory_limit() && bytes > memory_limit_) {
- return Status(errors::ResourceExhausted(
+ return errors::ResourceExhausted(
"Attempted to insert tensors with combined size of '", bytes,
"' bytes into Staging Area with a memory limit of '", memory_limit_,
- "'."));
+ "'.");
}
return Status::OK();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。