-
-
Notifications
You must be signed in to change notification settings - Fork 264
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 segfault in h5dump caused by corrupted btree node level #5002
Conversation
Added another argument, expected node level, to H5B__iterate_helper to pass down to H5B__cache_deserialize for checking the decoded node level. When this expected level is not known, the new macro H5_UNKNOWN_NODELEVEL (-1) will be used for not checking the level. Fixes HDFGroupGH-4432
src/H5Bpkg.h
Outdated
@@ -60,6 +60,7 @@ typedef struct H5B_t { | |||
typedef struct H5B_cache_ud_t { | |||
H5F_t *f; /* File that B-tree node is within */ | |||
const struct H5B_class_t *type; /* Type of tree */ | |||
unsigned exp_level; /* Expected level of the current node */ |
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'd make this an int and not unsigned since -1 is a valid value.
src/H5Bprivate.h
Outdated
/* Indicates that the level of the current node is unknown. When the level | ||
* is known, it can be used to detect corrupted level during decoding | ||
*/ | ||
#define H5B_UNKNOWN_NODELEVEL (unsigned)-1 |
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.
This should probably move to H5Bpkg.h
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.
This won't help if the level in the root B-tree node is corrupted, but (again) tightens the bounds.
…#5002) Added another argument, expected node level, to H5B__iterate_helper to pass down to H5B__cache_deserialize for checking the decoded node level. When this expected level is not known, the new macro H5_UNKNOWN_NODELEVEL (-1) will be used for not checking the level. Fixes HDFGroupGH-4432
Re-do of PR #4862
Added another argument, expected node level, to H5B__iterate_helper to pass down to H5B__cache_deserialize for checking the decoded node level. When this expected level is not known, the new macro H5B_UNKNOWN_NODELEVEL (-1) will be used for not checking the level.
Fixes GH-4432