Skip to content

Conversation

@ATrivialAtomic
Copy link
Contributor

This PR changes #define ASSIGN_CHECK_VAL(var, str, minval) to compare val > DBL_MAX instead of val > UINT_MAX.

This fixes an issue where, when mem_limit= exceeds 4.29G, the resulting return from unit_evaluate_dbl will exceed UINT_MAX limit and return an unexpected error.

`unit_evaluate_dbl()` returns a double and in certain cases, the returned val may exceed UINT_MAX, causing an unexpected error.
@MartinPulec
Copy link
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 val is INFINITY; maybe also some other special dbl values). As this particular check there is mainly not to overflow the destination type, wouldn't be better to compare to the maximal value of the dst type instead, eg. std::numeric_limits<typeof var>::max()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants