usnistgov / SP800-90B_EntropyAssessment

The SP800-90B_EntropyAssessment C++package implements the min-entropy assessment methods included in Special Publication 800-90B.
202 stars 87 forks source link

Uninitialized comparison in max_map in shared/utils.h #122

Closed mclearn closed 5 years ago

mclearn commented 5 years ago

In shared/utils.h, max_key is uninitialized as detected by static analysis tools. However, since key values appear to be initialized to 1 (and only grow) in all use cases, functionally, it shouldn't be an issue since itr->second > max_cnt will always result as true before the equality check comes into play. To avoid static analysis warnings, perhaps consider setting max_key to 0.

joshuaehill commented 5 years ago

Pull request #118 resolves this by just removing this function (and, indeed, removing the fundamentally linear search that is implemented in this function!)