-
Notifications
You must be signed in to change notification settings - Fork 719
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 large timestamp causing overflow #3106
Conversation
Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR. Commit dbb3ae3af505a3e4825d5f13db9b79ec22d25f73The key change made in this patch is in the function However, potential issues exist. The conversion between Another point to consider is whether the rest of the code and interacting systems can safely handle Finally, one would need to verify if overflow is the only issue with large timestamps. Other potential problems like precision loss or rounding errors should also be checked. Depending on how this function is used, such problems might need to be handled as well. All these considerations should be tested as part of a comprehensive set of unit and integration tests to ensure the functionality remains intact after this change. |
This commit fixes a bug in `toTimespec`. The duration overflows with a large timestamp because `std::chrono::nanoseconds` is signed 64-bit integer. Instead, we should explicitly use `uint64_t` because `__wasi_timestamp_t` is unsigned 64-bit. Signed-off-by: Yage Hu <me@huyage.dev>
94d2f46
to
dbb3ae3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3106 +/- ##
=======================================
Coverage 80.84% 80.84%
=======================================
Files 159 159
Lines 23035 23035
Branches 4734 4734
=======================================
+ Hits 18622 18623 +1
Misses 3131 3131
+ Partials 1282 1281 -1 ☔ View full report in Codecov by Sentry. |
@hydai Can you please take a look? Thanks. |
Hi @yagehu |
This commit fixes a bug in
toTimespec
. The duration overflows with a large timestamp becausestd::chrono::nanoseconds
is signed 64-bit integer. Instead, we should explicitly useuint64_t
because__wasi_timestamp_t
is unsigned 64-bit.fixes #3105