-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
Add check for decoded datatype precision overflow #4315
base: develop
Are you sure you want to change the base?
Add check for decoded datatype precision overflow #4315
Conversation
Related to #4309. Adds a check to make sure that |
Adds a check for the case where a decoded datatype's precision could overflow SIZE_MAX due to the size of a datatype being larger than SIZE_MAX / 8
a46b0ea
to
af51b92
Compare
@@ -45,8 +45,7 @@ | |||
#define H5T_NAMELEN 32 | |||
|
|||
/* Macro to ease detecting "complex" datatypes (i.e. those with base types or fields) */ | |||
#define H5T_IS_COMPLEX(t) \ | |||
((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY || (t) == H5T_REFERENCE) | |||
#define H5T_IS_COMPLEX(t) ((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY) |
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.
I believe H5T_REFERENCE
was only added to this macro to make the logic in H5T_set_loc
work correctly for reference types. Reference types are treated as atomic types, but would be excluded when checking a datatype with the H5T_IS_ATOMIC
macro due to the !H5T_IS_COMPLEX
check.
@@ -6347,8 +6349,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) | |||
* them as part of the same blob)*/ | |||
/* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */ | |||
if (dt->shared->parent->shared->force_conv && | |||
H5T_IS_COMPLEX(dt->shared->parent->shared->type) && | |||
(dt->shared->parent->shared->type != H5T_REFERENCE)) { | |||
H5T_IS_COMPLEX(dt->shared->parent->shared->type)) { |
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.
Weird indenting
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.
What about the other places that use H5T_IS_COMPLEX?
When I looked at the other occurrences previously, there are four occurrences in H5T.c, three of which are addressed here. The other one is in There is one occurrence in H5Tvisit.c in There are three occurrences in H5Tvlen.c, all in |
Adds a check for the case where a decoded datatype's precision could overflow SIZE_MAX due to the size of a datatype being larger than SIZE_MAX / 8