Skip to content

Commit

Permalink
Fix a few Clang sanitizer warnings (HDFGroup#1727)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF committed May 8, 2022
1 parent e0b64df commit 4baf21e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/H5Tconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3251,9 +3251,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;
Expand All @@ -3263,7 +3264,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 {
Expand Down Expand Up @@ -3407,7 +3409,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;
} /* end for */

/* Decrement number of elements left to convert */
Expand Down
11 changes: 7 additions & 4 deletions test/dsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -12508,10 +12508,13 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl)
hid_t dcpl = -1;
hid_t msid = -1;
H5D_chunk_index_t idx_type;
const hsize_t shape[2] = {8, 8};
const hsize_t maxshape[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
const hsize_t chunk[2] = {8, 8};
const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
const hsize_t shape[2] = {8, 8};
const hsize_t maxshape[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
const hsize_t chunk[2] = {8, 8};
const int buffer[8][8] = {{0, 1, 2, 3, 4, 5, 6, 7}, {8, 9, 10, 11, 12, 13, 14, 15},
{16, 17, 18, 19, 20, 21, 22, 23}, {24, 25, 26, 27, 28, 29, 30, 31},
{32, 33, 34, 35, 36, 37, 38, 39}, {40, 41, 42, 43, 44, 45, 46, 47},
{48, 49, 50, 51, 52, 53, 54, 55}, {56, 57, 58, 59, 60, 61, 62, 63}};
H5O_info_t info;

TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly");
Expand Down

0 comments on commit 4baf21e

Please sign in to comment.