vcomp/cmpto_j2k.cpp - Update val comparison to DBL_MAX#473
Merged
MartinPulec merged 1 commit intoCESNET:masterfrom Nov 21, 2025
Merged
vcomp/cmpto_j2k.cpp - Update val comparison to DBL_MAX#473MartinPulec merged 1 commit intoCESNET:masterfrom
MartinPulec merged 1 commit intoCESNET:masterfrom
Conversation
`unit_evaluate_dbl()` returns a double and in certain cases, the returned val may exceed UINT_MAX, causing an unexpected error.
Collaborator
|
I got the point. I understand that for mem_limit, 4 GiB may not be sufficient in general. But the comparison to DBL_MAX in doubles will be AFAIK almost always true (unless the |
Collaborator
|
Nevermind, I think that I can merge is as is and I'll improve it thereafter. |
MartinPulec
added a commit
that referenced
this pull request
Nov 21, 2025
check maximal value to fit the destination target type Note: the `nextafter(..., -INF)` is used to represent a value of type max that is also representable by double. Depending on the rounding mode, eg. `(double) LLONG_MAX` may round up - in this case 9223372036854775807 becomes ..808. improves <#473>
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.
This PR changes
#define ASSIGN_CHECK_VAL(var, str, minval)to compareval > DBL_MAXinstead ofval > UINT_MAX.This fixes an issue where, when
mem_limit=exceeds 4.29G, the resulting return fromunit_evaluate_dblwill exceed UINT_MAX limit and return an unexpected error.