summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-03-24 20:30:09 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-03-24 20:30:09 (GMT)
commitad8460cc16666267fdece9f75cba6d9732f1f46b (patch)
tree79d52b142cb23b3e8bf3c31d5ed15940e749bda4 /test
parente7b2095809f1711b0b08a9cbb46cbd058d3d3297 (diff)
downloadhdf5-ad8460cc16666267fdece9f75cba6d9732f1f46b.zip
hdf5-ad8460cc16666267fdece9f75cba6d9732f1f46b.tar.gz
hdf5-ad8460cc16666267fdece9f75cba6d9732f1f46b.tar.bz2
When creating a shadow index for testing, increase the page number from
one entry to the next by *at least* 1 so that the index is well-formed. This fixes a crash that occurred with H5_SHADOW_INDEX_SEED=1585006453.
Diffstat (limited to 'test')
-rw-r--r--test/vfd_swmr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c
index 4aa5390..fd9e752 100644
--- a/test/vfd_swmr.c
+++ b/test/vfd_swmr.c
@@ -2717,6 +2717,8 @@ test_shadow_index_lookup(void)
const uint64_t modulus = UINT64_MAX / MAX(1, cursize);
uint64_t pageno;
+ assert(modulus > 1); // so that modulus - 1 > 0, below
+
idx = calloc(cursize, sizeof(*idx));
if (idx == NULL) {
fprintf(stderr, "couldn't allocate %" PRIu32 " indices\n",
@@ -2725,7 +2727,7 @@ test_shadow_index_lookup(void)
}
for (pageno = (uint64_t)random() % modulus, j = 0;
j < cursize;
- j++, pageno += (uint64_t)random() % modulus) {
+ j++, pageno += 1 + (uint64_t)random() % (modulus - 1)) {
idx[j].hdf5_page_offset = pageno;
}
for (j = 0; j < cursize; j++) {