Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H5repack tests should fail if a corrupted file causes h5repack to #1138

Merged
merged 2 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,17 @@ Bug Fixes since HDF5-1.12.0 release

(NAF - 2021/01/22)

- Fixed CVE-2018-17432

The tool h5repack produced a segfault on a corrupted file which had
invalid rank for scalar or NULL datatype.

The problem was fixed by modifying the dataspace encode and decode
functions to detect and report invalid rank. h5repack now fails
with an error message for the corrupted file.

(BMR - 2020/10/26, HDFFV-10590)

- Creation of dataset with optional filter

When the combination of type, space, etc doesn't work for filter
Expand Down
6 changes: 3 additions & 3 deletions tools/test/h5repack/CMakeTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1544,20 +1544,20 @@
# the references in attribute of compund or vlen datatype
ADD_H5_TEST (HDFFV-5932 "TEST" ${FILE_ATTR_REF})

# Add test for memory leak in attirbute. This test is verified by CTEST.
# Add test for memory leak in attribute. This test is verified by CTEST.
# 1. leak from vlen string
# 2. leak from compound type without reference member
# (HDFFV-7840, )
# Note: this test is experimental for sharing test file among tools
ADD_H5_TEST (HDFFV-7840 "TEST" h5diff_attr1.h5)

# test CVE-2018-17432 fix
set (arg h5repack_CVE-2018-17432.h5 h5repack__CVE-2018-17432_out.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6)
set (arg h5repack_CVE-2018-17432.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6)
set (TESTTYPE "TEST")
ADD_H5_FILTER_TEST (HDFFV-10590 "" ${TESTTYPE} 1 ${arg})

# test CVE-2018-14460 fix
set (arg h5repack_CVE-2018-14460.h5 h5repack_CVE-2018-14460_out.h5)
set (arg h5repack_CVE-2018-14460.h5)
set (TESTTYPE "TEST")
ADD_H5_FILTER_TEST (HDFFV-11223 "" ${TESTTYPE} 1 ${arg})

Expand Down
17 changes: 14 additions & 3 deletions tools/test/h5repack/h5repack.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -885,13 +885,24 @@ TOOLTEST_FAIL()
(
cd $TESTDIR
$ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
) >$actual
) >&$actual
RET=$?
if [ $RET == 0 ] ; then

# Normally h5repack of files tested with this function are expected
# to return not 0, but if the command results in "Segmentation fault"
# or "core dumped" it is a failure regardless of the return value.
failure=`grep -e 'Segmentation fault' -e 'core dumped' $actual`
if [ "$failure" != "" ]; then
nerrors="`expr $nerrors + 1`"
echo " FAILED"
echo " $failure"
else
echo " PASSED"
if [ $RET == 0 ] ; then
nerrors="`expr $nerrors + 1`"
echo " FAILED"
else
echo " PASSED"
fi
fi
rm -f $outfile
}
Expand Down