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

fix: Summarizer::VariationKey operator< was unsound #412

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Jun 1, 2024

This is a soundness bug that was detected by MSVC in debug configuration.

The Summarizer::VariationKey has == and < operators.

In the case of <, the comparison wasn't properly handling the case where this->variation was greater than the parameter. In that case, it would fall back to comparing this->version which is incorrect (should only happen if the variations are equal.)

This could have affected the JSON serialization of the summary counters, mainly the order in which the array was serialized. I'm wondering if it could also caused bugs in actual counts. std::map uses the < operator to determine key equality.

@cwaldren-ld cwaldren-ld force-pushed the cw/sc-246162/unsound-comparison-op branch from fbbbe8f to 2370fae Compare June 1, 2024 00:19
@cwaldren-ld cwaldren-ld force-pushed the cw/sc-246162/unsound-comparison-op branch from af894f0 to 34e0ef3 Compare June 3, 2024 17:28
@cwaldren-ld cwaldren-ld marked this pull request as ready for review June 11, 2024 18:01
@cwaldren-ld cwaldren-ld requested a review from a team June 11, 2024 18:01
@cwaldren-ld cwaldren-ld merged commit 57f45b2 into main Jun 11, 2024
20 checks passed
@cwaldren-ld cwaldren-ld deleted the cw/sc-246162/unsound-comparison-op branch June 11, 2024 19:30
@github-actions github-actions bot mentioned this pull request Jun 11, 2024
cwaldren-ld pushed a commit that referenced this pull request Jun 12, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-cpp-client: 3.6.1</summary>

##
[3.6.1](launchdarkly-cpp-client-v3.6.0...launchdarkly-cpp-client-v3.6.1)
(2024-06-11)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-internal bumped from 0.8.0 to 0.8.1
</details>

<details><summary>launchdarkly-cpp-internal: 0.8.1</summary>

##
[0.8.1](launchdarkly-cpp-internal-v0.8.0...launchdarkly-cpp-internal-v0.8.1)
(2024-06-11)


### Bug Fixes

* Summarizer::VariationKey operator&lt; was unsound
([#412](#412))
([57f45b2](57f45b2))
</details>

<details><summary>launchdarkly-cpp-server: 3.5.1</summary>

##
[3.5.1](launchdarkly-cpp-server-v3.5.0...launchdarkly-cpp-server-v3.5.1)
(2024-06-11)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-internal bumped from 0.8.0 to 0.8.1
</details>

<details><summary>launchdarkly-cpp-server-redis-source: 2.1.9</summary>

##
[2.1.9](launchdarkly-cpp-server-redis-source-v2.1.8...launchdarkly-cpp-server-redis-source-v2.1.9)
(2024-06-11)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-server bumped from 3.5.0 to 3.5.1
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants