-
Notifications
You must be signed in to change notification settings - Fork 282
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
More bounds checking in Adjust::adjustDateTime #2244
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2244 +/- ##
==========================================
+ Coverage 63.42% 63.45% +0.03%
==========================================
Files 117 118 +1
Lines 19593 19608 +15
Branches 9551 9561 +10
==========================================
+ Hits 12426 12442 +16
Misses 5098 5098
+ Partials 2069 2068 -1
Continue to review full report at Codecov.
|
bd47e0f
to
5343ddc
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.
Thanks for taking care of this.
At first sight all the additions look good, but I am always a bit skeptical with changes not providing its own tests to validate the implementation. Since these changes are in the application level, you cannot add simple tests in the unitTests
target. However, I think it should be possible to add some integration tests in the python suite to exercise this new code.
I let you decide if you want to address such task in this PR or create a new issue describing the lack of tests for this new code, so that somebody else (or you in the future) want to take care of that.
@piponazo: thanks for the review! I added a new test, which triggers 6 of the 8 new error messages. I don't believe it's currently possible to trigger the "seconds" error message because I can't find a command-line argument that will let me enter a large number for the seconds adjustment. |
f9c90f5
to
2e0ab1a
Compare
Great! Thanks for the extra effort 💪 |
I moved #2231 to draft because it had some build failures on Windows, caused by the code in
Adjust::adjustDateTime
. The problem is thatstruct tm
has fields of typeint
, which means that there's quite a lot of implicit casting happening here.In this PR, I've added some bounds checking,
static_cast
, andSafe::add
, to make the conversions explicit. After this PR is merged, I'll be able to fix the build failures in #2231 more easily.