summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRay Lu <songyulu@hdfgroup.org>2018-12-07 20:58:43 (GMT)
committerRay Lu <songyulu@hdfgroup.org>2018-12-07 20:58:43 (GMT)
commit4643860aa940fb52da251f7023ec2e48d7d10f34 (patch)
treeb426b549e5b9afdf325a251c220a77cb54b4e9b8 /src
parent3682071b4a3760959c2ccc80d6de58a8d81b5048 (diff)
parent3e8599591504c95d8a97100b9546174f6132dc97 (diff)
downloadhdf5-4643860aa940fb52da251f7023ec2e48d7d10f34.zip
hdf5-4643860aa940fb52da251f7023ec2e48d7d10f34.tar.gz
hdf5-4643860aa940fb52da251f7023ec2e48d7d10f34.tar.bz2
Merge pull request #1348 in HDFFV/hdf5 from ~SONGYULU/hdf5_ray:bugfix/HDFFV-10635-hdf5-library-segmentation-fault to develop
* commit '3e8599591504c95d8a97100b9546174f6132dc97': HDFFV-10635: Some minor changes to the test case and the comments in the library. HDFFV-10635: add a test case. HDFFV-10635: Allowing to write the same variable-length element more than once.
Diffstat (limited to 'src')
-rw-r--r--src/H5HG.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index b9d8dc3..df1c82d 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -785,7 +785,14 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
HDassert(hobj->idx < heap->nused);
- HDassert(heap->obj[hobj->idx].begin);
+
+ /* When the application selects the same location to rewrite the VL element by using H5Sselect_elements,
+ * it can happen that the entry has been removed by first rewrite. Here we simply skip the removal of
+ * the entry and let the second rewrite happen (see HDFFV-10635). In the future, it'd be nice to handle
+ * this situation in H5T_conv_vlen in H5Tconv.c instead of this level (HDFFV-10648). */
+ if(heap->obj[hobj->idx].nrefs == 0 && heap->obj[hobj->idx].size == 0 && !heap->obj[hobj->idx].begin)
+ HGOTO_DONE(ret_value)
+
obj_start = heap->obj[hobj->idx].begin;
/* Include object header size */
need = H5HG_ALIGN(heap->obj[hobj->idx].size) + H5HG_SIZEOF_OBJHDR(f);