Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid default configs for SOL #20

Open
leiyu-bytedance opened this issue Aug 12, 2021 · 0 comments
Open

Invalid default configs for SOL #20

leiyu-bytedance opened this issue Aug 12, 2021 · 0 comments

Comments

@leiyu-bytedance
Copy link
Contributor

The commit 2908695 introduces the issue that the default SOL configs become invalid.

The function updateSOLParameter() has below piece of code:

  1     progress = std::get<uint8_t>(properties["Progress"]);
  2
  3     enable = std::get<bool>(properties["Enable"]);
  4
  5     forceEncrypt = std::get<bool>(properties["ForceEncryption"]);
  6
  7     forceAuth = std::get<bool>(properties["ForceAuthentication"]);
  8
  9     solMinPrivilege = static_cast<session::Privilege>(
 10         std::get<uint8_t>(properties["Privilege"]));
 11
 12     accumulateInterval =
 13         std::get<uint8_t>((properties["AccumulateIntervalMS"])) *
 14         sol::accIntervalFactor * 1ms;
 15
 16     sendThreshold = std::get<uint8_t>(properties["Threshold"]);
 17
 18     retryCount = std::get<uint8_t>(properties["RetryCount"]);
 19
 20     retryInterval = std::get<uint8_t>(properties["RetryIntervalMS"]) *
 21                     sol::retryIntervalFactor * 1ms;

It does not check the existence of the item in the map but uses properties["xxx"] directly. When the key does not exist in the map, the code creates a default one with default values (e.g. 0), then the default initial values defined in sol_manager.hpp are overwritten.

It has a side effect that the accumulateInterval becomes 0, then the timer will be triggered without valid value, and costs all CPU usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant