Skip to content

Commit

Permalink
fix year range of date
Browse files Browse the repository at this point in the history
  • Loading branch information
caton-hpg committed Aug 24, 2022
1 parent c700d29 commit da33162
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/time/TimeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ constexpr int64_t kMaxTimestamp = std::numeric_limits<int64_t>::max() / 10000000
return Status::Error("Invalid value type.");
}
if (kv.first == "year") {
if (kv.second.getInt() < std::numeric_limits<int16_t>::min() ||
// year should be in [-32767, 32767] and same as parser
if (kv.second.getInt() <= std::numeric_limits<int16_t>::min() ||
kv.second.getInt() > std::numeric_limits<int16_t>::max()) {
return Status::Error("Out of range year `%ld'.", kv.second.getInt());
}
Expand Down

0 comments on commit da33162

Please sign in to comment.