h5dump: SIGSEGV in render_bin_output when dumping dataset with native binary output
- Dominant language
- C
- Stars
- 988
- Forks
- 355
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 12
Description
**Describe the bug**
Running `h5dump` on a HDF5 file with native binary output enabled causes a segmentation fault in `render_bin_output()` during dataset dumping.
The crash occurs while processing the dataset `vlen_strings`. The stack shows the crash reaching `render_bin_output()` from `h5tools_dump_simple_data()` / `h5tools_dump_simple_dset()`.
**Steps to Reproduce:**
The PoC input file is:
[Null_Pointer_01.zip](https://github.com/user-attachments/files/29442091/Null_Pointer_01.zip)
Command line:
./h5dump -b NATIVE -o raw_output.out Null_Pointer_01
**Expected behavior**
h5dump should exit cleanly with an error message, rather than crashing with SIGSEGV.
**Platform (please complete the following information)**
- HDF5 version:
- Git branch: develop
- Commit: 8a2fb79
- OS and version:
- Ubuntu 22.04.5 LTS
- Compiler and version:
- clang: Ubuntu clang version 14.0.0-1ubuntu1.1
- gcc: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0
- Build system and generator:
- CMake 4.3.2
- Generator: Unix Makefiles, if you used the default CMake generator
- Configure options:
- Not explicitly recorded in this run.
- If same as the previous report:
`-DHDF5_BUILD_TOOLS=ON -DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_TESTING=OFF -DHDF5_BUILD_HL_LIB=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo`
- MPI library and version:
- Parallel HDF5 not enabled; no MPI library used.
**Additional context**
GDB output excerpt:
Program received signal SIGSEGV, Segmentation fault.
#0 0x00007fbf3db388bd in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x0000000000457372 in render_bin_output (
stream=0x498e6120,
container=container@entry=360287970189639681,
tid=tid@entry=216172782113783936,
_mem=_mem@entry=0x498f1430,
block_nelmts=block_nelmts@entry=4)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/lib/h5tools.c:1838
#2 0x0000000000468a1a in h5tools_dump_simple_data (
stream=0x498e6120,
info=0x7fff0c05e138,
ctx=0x7fff0c05db10,
container=2,
flags=,
nelmts=11572672,
type=216172782113783936,
_mem=0x153d380 )
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/lib/h5tools_dump.c:275
#3 h5tools_dump_simple_dset (
stream=0x498e6120,
info=0x7fff0c05e138,
ctx=0x7fff0c05db10,
dset=2,
p_type=216172782113783936)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/lib/h5tools_dump.c:1756
#4 h5tools_dump_dset (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/lib/h5tools_dump.c:1948
#5 h5tools_dump_data (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/lib/h5tools_dump.c:4508
#6 0x0000000000438b47 in dump_dataset (
did=22270848,
name=0x498f13d0 "vlen_strings",
sset=0x0)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/src/h5dump/h5dump_ddl.c:1087
#7 0x00000000004368f8 in dump_all_cb (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/src/h5dump/h5dump_ddl.c:365
Contributor guide
Assessment
This issue has not been assessed yet.