admin_fuzzer: fix too large param to cpu_stats_size setter
Don't pop an empty container, also use stol() so it does not throw std::out_of_range. Change-Id: Id81cb00ccfb0ecc234b8f6fa89edf5a0d8c6d353 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92524 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
parent
6b8456679f
commit
72cfcf7f3e
3 changed files with 6 additions and 1 deletions
BIN
fuzzer/admin-data/crash-00efc256446b2866e6fdec23e04dc28fcc3b1e6c
Normal file
BIN
fuzzer/admin-data/crash-00efc256446b2866e6fdec23e04dc28fcc3b1e6c
Normal file
Binary file not shown.
|
@ -238,7 +238,7 @@ void AdminSocketHandler::handleMessage(const std::vector<char> &payload)
|
|||
}
|
||||
else if (settingName == "cpu_stats_size")
|
||||
{
|
||||
if (settingVal != std::stoi(model.query(settingName)))
|
||||
if (settingVal != std::stol(model.query(settingName)))
|
||||
{
|
||||
model.setCpuStatsSize(settingVal);
|
||||
}
|
||||
|
|
|
@ -401,6 +401,11 @@ void AdminModel::setCpuStatsSize(unsigned size)
|
|||
int wasteValuesLen = _cpuStats.size() - size;
|
||||
while (wasteValuesLen-- > 0)
|
||||
{
|
||||
if (_cpuStats.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
_cpuStats.pop_front();
|
||||
}
|
||||
_cpuStatsSize = size;
|
||||
|
|
Loading…
Reference in a new issue