-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
MDEV-34621: Fix division by zero in mariadb-slap when iterations=0 #3892
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test case and amend your fix.
8192b45
to
88a6cfd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjust commit comment according to https://github.com/MariaDB/server/blob/11.0/CODING_STANDARDS.md
That is split long lines. Sentences should end with period.
Could you also retarget it for 10.6? Or I can do it myself once PR is approved.
mariadb-slap crashes with a floating point exception when run with -iterations=0 due to division by zero in generate_stats(). This occurs when calculating average timing by dividing by the number of iterations. To fix this, the solution checks if iterations == 0 before performing the division, and returns early from the function in such cases.
Description
mariadb-slap
crashes with a floating point exception when run with-i0
due to division by zero ingenerate_stats()
. This occurs when calculating average timing by dividing by the number of iterations.Instead of modifying the minimum value for the
-i
option (which would cause unexpected warning messages even with valid values), this PR implements a targeted fix in thegenerate_stats()
. The solution checks ifiterations == 0
before performing the division, and in such cases, returns early from the function.Release Notes
Fixed a floating point exception (division by zero) crash in
mariadb-slap
when running with-i0
(zero iterations).How can this PR be tested?
This PR can be tested by manually running mariadb-slap with zero iterations, which would previously cause a crash:
Or
Basing the PR against the correct MariaDB version
main
branch.PR quality check