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

internal/beater/config: fix 32-bit arch overflow #15216

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

axw
Copy link
Member

@axw axw commented Jan 13, 2025

Motivation/summary

Rather than converting from float64 to int and back, which may overflow on 32-bit architectures, check if the duration has a sub-second component through an integer modulo operation.

Checklist

How to test these changes

Run apm-server with the largest possible whole second duration for apm-server.agent.config.cache.expiration: 2562047h47m16s. Prior to this PR, that should fail on 32-bit architectures.

Related issues

None

Rather than converting from float64 to int and back,
which may overflow on 32-bit architectures, check if
the duration has a sub-second component through an
integer modulo operation.
@axw axw requested a review from a team as a code owner January 13, 2025 02:52
Copy link
Contributor

mergify bot commented Jan 13, 2025

This pull request does not have a backport label. Could you fix it @axw? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-7.17 is the label to automatically backport to the 7.17 branch.
  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • backport-8.x is the label to automatically backport to the 8.x branch.

Copy link
Contributor

mergify bot commented Jan 13, 2025

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Jan 13, 2025
@marclop marclop added backport-8.16 Automated backport with mergify and removed backport-8.16 Automated backport with mergify labels Jan 13, 2025
@axw axw enabled auto-merge (squash) January 13, 2025 03:03
@axw axw merged commit 53bbcaf into elastic:main Jan 14, 2025
15 checks passed
mergify bot pushed a commit that referenced this pull request Jan 14, 2025
* internal/beater/config: fix 32-bit arch overflow

Rather than converting from float64 to int and back,
which may overflow on 32-bit architectures, check if
the duration has a sub-second component through an
integer modulo operation.

* Add changelog

(cherry picked from commit 53bbcaf)
mergify bot added a commit that referenced this pull request Jan 14, 2025
* internal/beater/config: fix 32-bit arch overflow

Rather than converting from float64 to int and back,
which may overflow on 32-bit architectures, check if
the duration has a sub-second component through an
integer modulo operation.

* Add changelog

(cherry picked from commit 53bbcaf)

Co-authored-by: Andrew Wilkins <[email protected]>
@axw axw deleted the beaterconfig-agentconfig-cachexpiration branch January 15, 2025 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants