Unsigned int cannott be < 0
This commit is contained in:
parent
bc15deffb8
commit
b693308b33
@ -1344,6 +1344,10 @@ void TF_OperationGetAttrString(TF_Operation* oper, const char* attr_name,
|
||||
InvalidArgument("Attribute '", attr_name, "' is not a string");
|
||||
return;
|
||||
}
|
||||
if (max_length == 0) {
|
||||
InvalidArgument("Attribute '", max_length, "' is zero");
|
||||
return;
|
||||
}
|
||||
const auto& s = attr->s();
|
||||
std::memcpy(value, s.data(), std::min<size_t>(s.length(), max_length));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user