mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Limit the allowed epoch timestamps (#3651)
The code for parsing epoch timestamps when displaying tasks only supports values between year 1980 and 9999. Previous to this change, it was possible to set e.g., the due timestamp to a value outside of these limits, which would make it impossible to later on show the task. With this change, we only allow setting values within the same limits used by the code for displaying tasks.
This commit is contained in:
parent
2db373d631
commit
af8c5d58c8
1 changed files with 5 additions and 1 deletions
|
@ -190,7 +190,11 @@ void ColumnTypeDate::modify(Task& task, const std::string& value) {
|
|||
if (value != "" && evaluatedValue.get_date() == 0)
|
||||
throw format("'{1}' is not a valid date in the '{2}' format.", value, Variant::dateFormat);
|
||||
|
||||
task.set(_name, evaluatedValue.get_date());
|
||||
time_t epoch = evaluatedValue.get_date();
|
||||
if (epoch < EPOCH_MIN_VALUE || epoch >= EPOCH_MAX_VALUE) {
|
||||
throw format("'{1}' is not a valid date.", value);
|
||||
}
|
||||
task.set(_name, epoch);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue