-
-
Notifications
You must be signed in to change notification settings - Fork 270
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 a few Clang sanitizer warnings #1727
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3266,9 +3266,10 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si | |
/* If we're down to the last few elements, just wrap up */ | ||
/* with a "real" reverse copy */ | ||
if (safe < 2) { | ||
s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; | ||
d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; | ||
b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; | ||
s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; | ||
d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; | ||
if (bkg) | ||
b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; | ||
s_stride = -s_stride; | ||
d_stride = -d_stride; | ||
b_stride = -b_stride; | ||
|
@@ -3278,7 +3279,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si | |
else { | ||
s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride; | ||
d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride; | ||
b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; | ||
if (bkg) | ||
b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; | ||
} /* end else */ | ||
} /* end if */ | ||
else { | ||
|
@@ -3426,7 +3428,9 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si | |
/* Advance pointers */ | ||
s += s_stride; | ||
d += d_stride; | ||
b += b_stride; | ||
|
||
if (b) | ||
b += b_stride; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't do arithmetic on |
||
} /* end for */ | ||
|
||
/* Decrement number of elements left to convert */ | ||
|
@@ -3716,9 +3720,10 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz | |
/* If we're down to the last few elements, just wrap up */ | ||
/* with a "real" reverse copy */ | ||
if (safe < 2) { | ||
s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; | ||
d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; | ||
b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; | ||
s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; | ||
d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; | ||
if (bkg) | ||
b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; | ||
s_stride = -s_stride; | ||
d_stride = -d_stride; | ||
b_stride = -b_stride; | ||
|
@@ -3728,7 +3733,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz | |
else { | ||
s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride; | ||
d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride; | ||
b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; | ||
if (bkg) | ||
b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; | ||
} /* end else */ | ||
} /* end if */ | ||
else { | ||
|
@@ -3796,7 +3802,9 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz | |
/* Advance pointers */ | ||
s += s_stride; | ||
d += d_stride; | ||
b += b_stride; | ||
|
||
if (b) | ||
b += b_stride; | ||
} /* end for */ | ||
|
||
/* Decrement number of elements left to convert */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,9 +166,12 @@ H5VL__term_opt_operation(void) | |
FUNC_ENTER_PACKAGE_NOERR | ||
|
||
/* Iterate over the VOL subclasses */ | ||
for (subcls = 0; subcls < NELMTS(H5VL_opt_vals_g); subcls++) | ||
if (H5VL_opt_ops_g[subcls]) | ||
for (subcls = 0; subcls < NELMTS(H5VL_opt_vals_g); subcls++) { | ||
if (H5VL_opt_ops_g[subcls]) { | ||
H5SL_destroy(H5VL_opt_ops_g[subcls], H5VL__term_opt_operation_cb, NULL); | ||
H5VL_opt_ops_g[subcls] = NULL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set dynamic operations skip list array table entries to NULL to avoid a use after free during package termination. |
||
} | ||
} | ||
|
||
FUNC_LEAVE_NOAPI(SUCCEED) | ||
} /* H5VL__term_opt_operation() */ | ||
|
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.
Don't do arithmetic on
bkg
ifbkg
is a NULL pointer.