HDFGroup / HDFGroup/hdf5

Crash when copying a group with references to another file

Open
#3,429 5 comments 0 reactions 1 assignee Assigned to @jhendersonHDF View on GitHub
Component - C Library Component - Tools
Dominant language
C
Stars
988
Forks
355
Avg merge
4d 2h
Merged PRs (30d)
12

Description

**Describe the bug**
HDF5 crashes when copy "/composite_cae/Meshes/M1/Element_Types" of the linked file at the end of this report. The crash occurs with hdf5 1.12 and 1.14 when using the c++ API, h5py or the hdf5 tools.

- with hdf5 tools:

`"C:\Program Files\HDF_Group\HDF5\1.14.1\bin\h5copy.exe" -v -f ref -i "D:\tmp\input_mech.h5" -s "/composite_cae/" -o "D:\tmp\output.h5" -d "/copy"`

- with h5py
```
import h5py
source_h5 = h5py.File(r'D:\tmp\input_mech.h5','r')
composit_cae_group = source_h5.get("/composite_cae/")

target_h5 = h5py.File(r'D:\tmp\target.h5','w')
target_h5.copy(source=composit_cae_group, dest=target_h5, name="/copy", shallow=False, expand_soft=False, expand_external=False, expand_refs=True, without_attrs=False)
```

The crash occurs also when using c++ H5OCopy.

**Expected behavior**
The group is copied to the file and the references are updated correctly

**Platform (please complete the following information)**
- HDF5 version: 1.12 and 1.14
- OS and version: Windows 11
- Compiler and version: VS C++17
- Build system (e.g. CMake, Autotools) and version: premake5
- Any configure options you specified:
- MPI library and version (parallel HDF5): serial

**Additional context**
The crash disappears if the mesh (number of elements and nodes) is smaller.

**Attachements**
[Linked file](https://drive.google.com/file/d/1PLub8PTYb6Bki-1NrCPhCXwa8cO8MrDY/view?usp=sharing)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.