Repository navigation
YARN-12007. Avoid intermediate overflow in YARN unit conversion - #8817
Open
gerashegalov wants to merge 1 commit into
Open
gerashegalov wants to merge 1 commit into
gerashegalov wants to merge 1 commit into
Conversation
Contains content generated by OpenAI Codex. Signed-off-by: Gera Shegalov <gshegalov@nvidia.com>
|
🎊 +1 overall
This message was automatically generated. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
UnitsConversionUtil.convertcan overflow during intermediate multiplication even when the final result fits in along. For example, convertingLong.MAX_VALUEfromptoGreturns2instead of0, while converting10000fromPtoPithrows instead of returning8881.Use checked
longarithmetic for the common path andBigIntegerwhen an intermediate overflows. Reject only a final result outsidelong. Zero values return before multiplication, after unit validation. This change does not altercompare.Contains content generated by OpenAI Codex.
How was this patch tested?
TestUnitsConversionUtil,TestResourceUtils,TestTimelineServiceHelper, andTestResourcePBImpl: 33 tests passed, no failures or errors.git diff --checkpassed.For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles? (Not applicable.)AI Tooling
If an AI tool was used: