Merge pull request #10060 from Icinga/IcingaDB-SerializeState-execution_time-latency

IcingaDB#SerializeState(): limit execution_time and latency to 2^32-1
This commit is contained in:
Alexander Aleksandrovič Klimov 2024-06-13 09:55:45 +02:00 committed by GitHub
commit f1be9b73ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2642,8 +2642,8 @@ Dictionary::Ptr IcingaDB::SerializeState(const Checkable::Ptr& checkable)
if (!cr->GetCommand().IsEmpty())
attrs->Set("check_commandline", FormatCommandLine(cr->GetCommand()));
attrs->Set("execution_time", TimestampToMilliseconds(fmax(0.0, cr->CalculateExecutionTime())));
attrs->Set("latency", TimestampToMilliseconds(cr->CalculateLatency()));
attrs->Set("execution_time", std::min((long long)UINT32_MAX, TimestampToMilliseconds(fmax(0.0, cr->CalculateExecutionTime()))));
attrs->Set("latency", std::min((long long)UINT32_MAX, TimestampToMilliseconds(cr->CalculateLatency())));
attrs->Set("check_source", cr->GetCheckSource());
attrs->Set("scheduling_source", cr->GetSchedulingSource());
}