h5dump: null pointer dereference in H5T__path_find_real when dumping XML fill value
- Dominant language
- C
- Stars
- 988
- Forks
- 355
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 12
Description
**Describe the bug**
Running `h5dump -x` on a HDF5 file causes a segmentation fault in `H5T__path_find_real()`.
The crash occurs in the XML dump path while dumping the dataset `CharSets`. The stack shows `H5T__path_find_real()` being called with `src=0x0`, through `H5P_get_fill_value()` and `xml_dump_fill_value()`.
**Steps to Reproduce:**
The PoC input file is:
[Null_Pointer_02.zip](https://github.com/user-attachments/files/29442206/Null_Pointer_02.zip)
Command line:
./h5dump -x Null_Pointer_02
**Expected behavior**
h5dump should exit cleanly with an error message, rather than dereferencing a null type pointer and crashing.
**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 H5T__path_find_real (
src=src@entry=0x0,
dst=dst@entry=0x15e6ddf0,
name=name@entry=0x0,
conv=conv@entry=0x7ffc871a9ee8)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5T.c:5795
#1 0x00000000007dc9ea in H5T_path_find (
src=0x0,
dst=dst@entry=0x15e6ddf0)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5T.c:5719
#2 0x00000000006e0ff3 in H5P_get_fill_value (
plist=0x15e66fd0,
type=0x6,
type@entry=0x15e6ddf0,
value=value@entry=0x15e6ef40)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Pdcpl.c:3213
#3 0x00000000006e15e3 in H5Pget_fill_value (
plist_id=plist_id@entry=792633534417207322,
type_id=type_id@entry=216172782113783926,
value=0x15e6ef40)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Pdcpl.c:3292
#4 0x000000000044cd07 in xml_dump_fill_value (
dcpl=792633534417207322,
type=216172782113783925)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/src/h5dump/h5dump_xml.c:3599
#5 xml_dump_dataset (
did=did@entry=360287970189639681,
name=name@entry=0x15e66670 "CharSets",
sset=sset@entry=0x0)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/src/h5dump/h5dump_xml.c:4339
#6 0x0000000000447dc4 in xml_dump_all_cb (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/src/h5dump/h5dump_xml.c:341
#7 0x00000000005f4873 in H5G__iterate_cb (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Gint.c:883
Contributor guide
Assessment
This issue has not been assessed yet.