Skip to content

h5repack: SIGFPE in H5S__hyper_iter_get_seq_list when repacking dataset #6491

Description

@Nievesjyl

Describe the bug
Running h5repack on a HDF5 file causes an arithmetic exception in H5S__hyper_iter_get_seq_list() during dataset copy processing. The crash occurs in the hyperslab selection iteration path while h5repack is reading dataset data through H5Dread() and do_copy_objects().

Steps to Reproduce:

PoC input:

invalid_read.zip

Command line:

./h5repack -l CONTI invalid_read out.h5

Expected behavior
h5repack should exit cleanly with an error message, rather than crashing with SIGFPE during hyperslab selection iteration.

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 SIGFPE, Arithmetic exception.

#0 0x000000000078cece in H5S__hyper_iter_get_seq_list (
iter=iter@entry=0x24dca2d0,
maxseq=maxseq@entry=1024,
maxelem=maxelem@entry=9,
nseq=nseq@entry=0x7ffc78fa9250,
nelem=nelem@entry=0x7ffc78fa9260,
off=off@entry=0x24dc4288,
len=0x24dc2228)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Shyper.c:2632
#1 0x00000000007aa82f in H5S_select_iter_get_seq_list (
iter=iter@entry=0x24dca2d0,
maxseq=maxseq@entry=1024,
maxelmts=0,
maxelmts@entry=9,
nseq=0x0,
nseq@entry=0x7ffc78fa9250,
nelmts=0x15451a0 ,
nelmts@entry=0x7ffc78fa9260,
off=off@entry=0x24dc4288,
len=0x24dc2228)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Sselect.c:1302
#2 0x000000000053093e in H5D__select_io (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Dselect.c:206
#3 0x0000000000530487 in H5D__select_read (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Dselect.c:458
#4 0x0000000000a34d4a in H5D__chunk_read (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Dchunk.c:3204
#5 0x0000000000523f70 in H5D__read (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5Dio.c:398
#10 H5Dread (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/src/H5D.c:1049
#11 0x0000000000435229 in do_copy_objects (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/src/h5repack/h5repack_copy.c:1053
#12 0x0000000000431bb7 in copy_objects (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/src/h5repack/h5repack_copy.c:326
#13 0x00000000004553fa in h5repack (...)
at /root/SpecDrive/benchmarks/hdf5/hdf5/tools/src/h5repack/h5repack.c:53

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

Status
Planning

Relationships

None yet

Development

No branches or pull requests

Issue actions