diff --git a/cifti/CMakeLists.txt b/cifti/CMakeLists.txt index 9e539c20..ec8a4307 100644 --- a/cifti/CMakeLists.txt +++ b/cifti/CMakeLists.txt @@ -41,4 +41,13 @@ if(NIFTI_BUILD_TESTING AND NIFTI_BUILD_APPLICATIONS) -input ${CMAKE_CURRENT_LIST_DIR}/testdata/mim_known_child.xml ) set_tests_properties( ${TEST_PREFIX}_mim_summary_known_child PROPERTIES PASS_REGULAR_EXPRESSION "BrainModel" ) + + # An extension payload that fills esize-8 with no NUL must not be read + # past its end; the regex pins that the payload is still parsed. + add_test( NAME ${TEST_PREFIX}_tool_unterminated_cext + COMMAND $ + -input ${CMAKE_CURRENT_LIST_DIR}/testdata/cext_unterminated.nii + -eval_cext -eval_type show_summary ) + set_tests_properties( ${TEST_PREFIX}_tool_unterminated_cext + PROPERTIES PASS_REGULAR_EXPRESSION "MapName : demo" ) endif() diff --git a/cifti/testdata/cext_unterminated.nii b/cifti/testdata/cext_unterminated.nii new file mode 100644 index 00000000..43eb9b73 Binary files /dev/null and b/cifti/testdata/cext_unterminated.nii differ diff --git a/nifti2/CMakeLists.txt b/nifti2/CMakeLists.txt index 758df0b9..d369220c 100644 --- a/nifti2/CMakeLists.txt +++ b/nifti2/CMakeLists.txt @@ -189,6 +189,55 @@ if(NIFTI_BUILD_TESTING AND NIFTI_BUILD_APPLICATIONS) endif() endif() + # A dim[0] outside 1..7 must be refused rather than used to index dim[]. + add_test( NAME ${TEST_PREFIX}_tool_disp_nim_bad_dim0 COMMAND $ -disp_nim -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/n2_bad_dim0.nii ) + set_tests_properties( ${TEST_PREFIX}_tool_disp_nim_bad_dim0 PROPERTIES PASS_REGULAR_EXPRESSION "bad dim\\[0\\]" ) + + # A nifti_1_header is swapped at NIFTI-1 width whatever its magic claims. + add_test( NAME ${TEST_PREFIX}_tool_check_hdr_magic_n2 COMMAND $ -check_hdr -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/n1_magic_n2.nii ) + set_tests_properties( ${TEST_PREFIX}_tool_check_hdr_magic_n2 PROPERTIES PASS_REGULAR_EXPRESSION "header IS GOOD" ) + + # The tool's own header copies are swapped at their own width too. Both + # invocations rewrite the file, so each works on a copy. + add_test( NAME ${TEST_PREFIX}_tool_mod_hdr_magic_n2_setup COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/testdata/n1_magic_n2.nii ${CMAKE_CURRENT_BINARY_DIR}/mod_magic_n2.nii ) + add_test( NAME ${TEST_PREFIX}_tool_mod_hdr_magic_n2 COMMAND $ -mod_hdr -mod_field descrip hello -overwrite -infiles ${CMAKE_CURRENT_BINARY_DIR}/mod_magic_n2.nii ) + set_tests_properties( ${TEST_PREFIX}_tool_mod_hdr_magic_n2 PROPERTIES DEPENDS ${TEST_PREFIX}_tool_mod_hdr_magic_n2_setup ) + add_test( NAME ${TEST_PREFIX}_tool_swap_as_old_magic_n2_setup COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/testdata/n1_magic_n2.nii ${CMAKE_CURRENT_BINARY_DIR}/swap_magic_n2.nii ) + add_test( NAME ${TEST_PREFIX}_tool_swap_as_old_magic_n2 COMMAND $ -swap_as_old -overwrite -infiles ${CMAKE_CURRENT_BINARY_DIR}/swap_magic_n2.nii ) + set_tests_properties( ${TEST_PREFIX}_tool_swap_as_old_magic_n2 PROPERTIES DEPENDS ${TEST_PREFIX}_tool_swap_as_old_magic_n2_setup ) + + # Dimensions whose product overflows the voxel count are refused. + add_test( NAME ${TEST_PREFIX}_tool_reject_nvox_overflow_n1 COMMAND $ -disp_nim -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/n1_overflow.nii ) + add_test( NAME ${TEST_PREFIX}_tool_reject_nvox_overflow_n2 COMMAND $ -disp_nim -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/n2_overflow.nii ) + add_test( NAME ${TEST_PREFIX}_tool_reject_volsize_overflow COMMAND $ -disp_nim -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/n1_volsize.nii ) + set_tests_properties( ${TEST_PREFIX}_tool_reject_nvox_overflow_n1 ${TEST_PREFIX}_tool_reject_nvox_overflow_n2 + PROPERTIES PASS_REGULAR_EXPRESSION "dim\\[\\] overflows the voxel count" ) + set_tests_properties( ${TEST_PREFIX}_tool_reject_volsize_overflow + PROPERTIES PASS_REGULAR_EXPRESSION "dim\\[\\] and datatype overflow the volume size" ) + + # A repeated ASCII attribute releases the previous value, and the last + # one wins; the regex pins the surviving behavior. + add_test( NAME ${TEST_PREFIX}_tool_ascii_dup_attr COMMAND $ -disp_nim -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/dup_attr.nia ) + set_tests_properties( ${TEST_PREFIX}_tool_ascii_dup_attr PROPERTIES PASS_REGULAR_EXPRESSION "dup2.nia" ) + + # Only compiled when the FSL name-conflict path is built. + if(FSLSTYLE_NAME_CONFLICTS) + add_test( NAME ${TEST_PREFIX}_ambiguous_hdrname + COMMAND ${CMAKE_COMMAND} -DTOOL=$ + -DDIR=${CMAKE_CURRENT_BINARY_DIR}/ambig + -P ${CMAKE_CURRENT_LIST_DIR}/ambiguous_hdrname.cmake ) + endif() + + if(UNIX AND NIFTI_SHELL_SCRIPT_TESTS) + # Reaches the failure paths that have to release the header before returning. + add_test( NAME ${TEST_PREFIX}_mod_hdr_errpaths COMMAND sh ${NIFTI_TEST_SCRIPT_DIR}/mod_header_errpaths.sh $ $ ) + endif() + + if(UNIX AND NIFTI_SHELL_SCRIPT_TESTS) + # Needs no external data, so it carries no NEEDS_DATA label. + add_test( NAME ${TEST_PREFIX}_nii_cmp_selftest COMMAND sh ${NIFTI_TEST_SCRIPT_DIR}/nii_cmp_selftest.sh ${NIFTI_TEST_SCRIPT_DIR} ) + endif() + unset(TEST_SUFFIX) unset(TEST_PREFIX) unset(TOOL_NAME) diff --git a/nifti2/ambiguous_hdrname.cmake b/nifti2/ambiguous_hdrname.cmake new file mode 100644 index 00000000..3353b6da --- /dev/null +++ b/nifti2/ambiguous_hdrname.cmake @@ -0,0 +1,30 @@ +# Drives the ambiguous-filename path, which must report the clash to its +# caller. A plain add_test cannot tell exit 1 from the abort it replaced. +file(REMOVE_RECURSE ${DIR}) +file(MAKE_DIRECTORY ${DIR}) + +execute_process(COMMAND ${TOOL} -make_im -new_dim 3 4 4 4 0 0 0 0 + -prefix ${DIR}/amb.nii RESULT_VARIABLE mk1) +execute_process(COMMAND ${TOOL} -make_im -new_dim 3 4 4 4 0 0 0 0 + -prefix ${DIR}/amb.nii.gz RESULT_VARIABLE mk2) +if(NOT mk1 STREQUAL "0" OR NOT mk2 STREQUAL "0") + message(FATAL_ERROR "could not create the ambiguous pair: ${mk1} ${mk2}") +endif() + +execute_process(COMMAND ${TOOL} -disp_hdr -infiles ${DIR}/amb + RESULT_VARIABLE rv ERROR_VARIABLE err OUTPUT_VARIABLE out) +if(NOT rv STREQUAL "1") + message(FATAL_ERROR "expected exit 1, got '${rv}'\n${err}") +endif() +if(NOT err MATCHES "Multiple possible filenames") + message(FATAL_ERROR "missing ambiguity diagnostic:\n${err}") +endif() + +# Unambiguous names must still resolve, so that returning NULL +# unconditionally could not pass. +file(REMOVE ${DIR}/amb.nii.gz) +execute_process(COMMAND ${TOOL} -disp_hdr -infiles ${DIR}/amb + RESULT_VARIABLE rv2 ERROR_VARIABLE err2 OUTPUT_VARIABLE out2) +if(NOT rv2 STREQUAL "0") + message(FATAL_ERROR "unambiguous name failed with '${rv2}'\n${err2}") +endif() diff --git a/nifti2/nifti2_io.c b/nifti2/nifti2_io.c index 3c782bc0..8e749950 100644 --- a/nifti2/nifti2_io.c +++ b/nifti2/nifti2_io.c @@ -6028,13 +6028,6 @@ nifti_image *nifti_image_read( const char *hname , int read_data ) znzclose(fp); free(hfile); return NULL; } - #ifdef REJECT_COMPLEX - if ((nim->datatype == DT_COMPLEX64) || (nim->datatype == DT_COMPLEX128) || (nim->datatype == DT_COMPLEX256)) { - fprintf(stderr,"Image Exception Unsupported datatype (COMPLEX64): use fslcomplex to manipulate: %s\n", hname); - exit(13); - } - #endif - if( nim == NULL ){ znzclose( fp ) ; /* close the file */ if( g_opts.debug > 0 ) @@ -6043,6 +6036,13 @@ nifti_image *nifti_image_read( const char *hname , int read_data ) return NULL; } + #ifdef REJECT_COMPLEX + if ((nim->datatype == DT_COMPLEX64) || (nim->datatype == DT_COMPLEX128) || (nim->datatype == DT_COMPLEX256)) { + fprintf(stderr,"Image Exception Unsupported datatype (COMPLEX64): use fslcomplex to manipulate: %s\n", hname); + exit(13); + } + #endif + if( g_opts.debug > 3 ){ fprintf(stderr,"+d nifti_image_read(), have nifti image:\n"); nifti_image_infodump(nim); diff --git a/nifti2/nifti_regress_test/cmake_testscripts/c22_copy_image.sh b/nifti2/nifti_regress_test/cmake_testscripts/c22_copy_image.sh index 18c435c9..d2910d1b 100644 --- a/nifti2/nifti_regress_test/cmake_testscripts/c22_copy_image.sh +++ b/nifti2/nifti_regress_test/cmake_testscripts/c22_copy_image.sh @@ -12,21 +12,7 @@ OUT_DATA=$(dirname ${DATA}) #Need to write to separate directory cd ${OUT_DATA} -# Compare two NIfTI files by content rather than by compressed bytes. -# -# gzip output is not reproducible across zlib implementations: zlib-ng, -# which Arch, CachyOS and other current distributions ship as the system -# zlib, encodes the same input differently from stock zlib. Comparing -# the .gz files directly therefore fails on those systems even though the -# image data round-trips perfectly. Decompress first and compare that. -nii_cmp() { - if [ "${1##*.}" = "gz" ]; then - gzip -dc "$1" > "$1.raw" && gzip -dc "$2" > "$2.raw" || return 1 - cmp "$1.raw" "$2.raw" - return $? - fi - cmp "$1" "$2" -} +. "$(dirname "$0")/nii_cmp.sh" # note the main input file and prefix for all output files infile=$DATA/e4.60005.nii.gz diff --git a/nifti2/nifti_regress_test/cmake_testscripts/mod_header_errpaths.sh b/nifti2/nifti_regress_test/cmake_testscripts/mod_header_errpaths.sh new file mode 100755 index 00000000..7ef0fd88 --- /dev/null +++ b/nifti2/nifti_regress_test/cmake_testscripts/mod_header_errpaths.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# Drive the two failure paths in nifti_tool's header modification, where +# the header and the duplicated name have to be released before returning. +# Both invocations are expected to fail, so a nonzero status cannot be the +# assertion: under a sanitizer it is also what a leak report exits with. +# The check is that the tool reported the failure and said nothing else. +# usage: mod_header_errpaths.sh [nifti1_tool] +NT=$1 +NT1=$2 +[ -x "$NT" ] || { echo "usage: $0 [nifti1_tool]"; exit 1; } + +if [ "$(id -u)" = "0" ]; then + echo "skipping: a read-only directory does not stop root" + exit 0 +fi + +tmp=$(mktemp -d) || exit 1 +trap 'chmod 755 "$tmp/ro" 2>/dev/null; rm -rf "$tmp"' EXIT +cd "$tmp" || exit 1 + +$NT -make_im -new_dim 3 4 4 4 0 0 0 0 -prefix anat0.nii || exit 1 +mkdir ro && chmod 555 ro + +# A. the write fails, so both the header and the duplicated name are held +out=$($NT -mod_hdr2 -prefix ro/anat1 -infiles anat0.nii \ + -mod_field qoffset_x -17.325 2>&1) +if [ $? -eq 0 ]; then + echo "FAIL: writing into a read-only directory succeeded" + echo "$out" + exit 1 +fi +case "$out" in + *Sanitizer*) echo "FAIL: sanitizer report on the write path"; echo "$out"; exit 1;; +esac + +# B. the duplication fails, so the header alone is held +if [ -n "$NT1" ] && [ -x "$NT1" ]; then + out=$($NT1 -mod_hdr -prefix ro/x1 -infiles anat0.nii \ + -mod_field qoffset_x -17.325 2>&1) + if [ $? -eq 0 ]; then + echo "FAIL: nifti1_tool accepted a NIFTI-2 input" + echo "$out" + exit 1 + fi + case "$out" in + *Sanitizer*) echo "FAIL: sanitizer report on the duplication path"; echo "$out"; exit 1;; + esac +fi + +echo "mod_header error paths reached" diff --git a/nifti2/nifti_regress_test/cmake_testscripts/nii_cmp.sh b/nifti2/nifti_regress_test/cmake_testscripts/nii_cmp.sh new file mode 100644 index 00000000..a232c21f --- /dev/null +++ b/nifti2/nifti_regress_test/cmake_testscripts/nii_cmp.sh @@ -0,0 +1,15 @@ +# Compare two NIfTI files by content rather than by compressed bytes. +# +# gzip output is not reproducible across zlib implementations: zlib-ng, +# which Arch, CachyOS and other current distributions ship as the system +# zlib, encodes the same input differently from stock zlib. Comparing +# the .gz files directly therefore fails on those systems even though the +# image data round-trips perfectly. Decompress first and compare that. +nii_cmp() { + if [ "${1##*.}" = "gz" ]; then + gzip -dc "$1" > "$1.raw" && gzip -dc "$2" > "$2.raw" || return 1 + cmp "$1.raw" "$2.raw" + return $? + fi + cmp "$1" "$2" +} diff --git a/nifti2/nifti_regress_test/cmake_testscripts/nii_cmp_selftest.sh b/nifti2/nifti_regress_test/cmake_testscripts/nii_cmp_selftest.sh new file mode 100755 index 00000000..2eecaada --- /dev/null +++ b/nifti2/nifti_regress_test/cmake_testscripts/nii_cmp_selftest.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Verify nii_cmp compares NIfTI content rather than compressed bytes. +# +# gzip -1 and gzip -9 encode the same input differently, which manufactures +# the byte difference locally instead of waiting for a runner whose system +# zlib happens to be zlib-ng. +# usage: nii_cmp_selftest.sh +. "$1/nii_cmp.sh" + +tmp=$(mktemp -d) || exit 1 +trap 'rm -rf "$tmp"' EXIT +cd "$tmp" || exit 1 + +head -c 65536 /dev/urandom > payload +gzip -1 -c payload > a.nii.gz +gzip -9 -c payload > b.nii.gz +head -c 65536 /dev/urandom > other +gzip -c other > c.nii.gz + +if cmp -s a.nii.gz b.nii.gz; then + echo "SKIP: this gzip encodes -1 and -9 identically, nothing to compare" + exit 0 +fi + +nii_cmp a.nii.gz b.nii.gz || { + echo "FAIL: identical content reported different"; exit 1; } +nii_cmp a.nii.gz c.nii.gz >/dev/null 2>&1 && { + echo "FAIL: differing content reported same"; exit 1; } +cp payload d.nii && cp payload e.nii +nii_cmp d.nii e.nii || { echo "FAIL: uncompressed path broken"; exit 1; } + +echo "nii_cmp selftest passed" diff --git a/nifti2/testdata/dup_attr.nia b/nifti2/testdata/dup_attr.nia new file mode 100644 index 00000000..ad9932a3 Binary files /dev/null and b/nifti2/testdata/dup_attr.nia differ diff --git a/nifti2/testdata/n1_magic_n2.nii b/nifti2/testdata/n1_magic_n2.nii new file mode 100644 index 00000000..725219c3 Binary files /dev/null and b/nifti2/testdata/n1_magic_n2.nii differ diff --git a/nifti2/testdata/n1_overflow.nii b/nifti2/testdata/n1_overflow.nii new file mode 100644 index 00000000..a5d8c10b Binary files /dev/null and b/nifti2/testdata/n1_overflow.nii differ diff --git a/nifti2/testdata/n1_volsize.nii b/nifti2/testdata/n1_volsize.nii new file mode 100644 index 00000000..98160d48 Binary files /dev/null and b/nifti2/testdata/n1_volsize.nii differ diff --git a/nifti2/testdata/n2_bad_dim0.nii b/nifti2/testdata/n2_bad_dim0.nii new file mode 100644 index 00000000..39c70245 Binary files /dev/null and b/nifti2/testdata/n2_bad_dim0.nii differ diff --git a/nifti2/testdata/n2_overflow.nii b/nifti2/testdata/n2_overflow.nii new file mode 100644 index 00000000..6402081f Binary files /dev/null and b/nifti2/testdata/n2_overflow.nii differ diff --git a/niftilib/CMakeLists.txt b/niftilib/CMakeLists.txt index 09d522d2..d3b09cd8 100644 --- a/niftilib/CMakeLists.txt +++ b/niftilib/CMakeLists.txt @@ -148,6 +148,25 @@ if(NIFTI_BUILD_TESTING AND NIFTI_BUILD_APPLICATIONS) ) #==END NIFTI1 and NIFTI2 common tests ============================================ + # The same guards in the NIFTI-1 library, reached through nifti1_tool. + add_test( NAME ${TEST_PREFIX}_tool_reject_nvox_overflow COMMAND $ -disp_nim -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/n1_overflow.nii ) + add_test( NAME ${TEST_PREFIX}_tool_reject_volsize_overflow COMMAND $ -disp_nim -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/n1_volsize.nii ) + set_tests_properties( ${TEST_PREFIX}_tool_reject_nvox_overflow + PROPERTIES PASS_REGULAR_EXPRESSION "dim\\[\\] overflows the voxel count" ) + set_tests_properties( ${TEST_PREFIX}_tool_reject_volsize_overflow + PROPERTIES PASS_REGULAR_EXPRESSION "dim\\[\\] and datatype overflow the volume size" ) + + # The NIFTI-1 library carries the same ASCII reader. + add_test( NAME ${TEST_PREFIX}_tool_ascii_dup_attr COMMAND $ -disp_nim -infiles ${CMAKE_CURRENT_LIST_DIR}/testdata/dup_attr.nia ) + set_tests_properties( ${TEST_PREFIX}_tool_ascii_dup_attr PROPERTIES PASS_REGULAR_EXPRESSION "dup2.nia" ) + + if(FSLSTYLE_NAME_CONFLICTS) + add_test( NAME ${TEST_PREFIX}_ambiguous_hdrname + COMMAND ${CMAKE_COMMAND} -DTOOL=$ + -DDIR=${CMAKE_CURRENT_BINARY_DIR}/ambig1 + -P ${CMAKE_CURRENT_LIST_DIR}/ambiguous_hdrname.cmake ) + endif() + unset(TEST_SUFFIX) unset(TEST_PREFIX) unset(TOOL_NAME) diff --git a/niftilib/ambiguous_hdrname.cmake b/niftilib/ambiguous_hdrname.cmake new file mode 100644 index 00000000..3353b6da --- /dev/null +++ b/niftilib/ambiguous_hdrname.cmake @@ -0,0 +1,30 @@ +# Drives the ambiguous-filename path, which must report the clash to its +# caller. A plain add_test cannot tell exit 1 from the abort it replaced. +file(REMOVE_RECURSE ${DIR}) +file(MAKE_DIRECTORY ${DIR}) + +execute_process(COMMAND ${TOOL} -make_im -new_dim 3 4 4 4 0 0 0 0 + -prefix ${DIR}/amb.nii RESULT_VARIABLE mk1) +execute_process(COMMAND ${TOOL} -make_im -new_dim 3 4 4 4 0 0 0 0 + -prefix ${DIR}/amb.nii.gz RESULT_VARIABLE mk2) +if(NOT mk1 STREQUAL "0" OR NOT mk2 STREQUAL "0") + message(FATAL_ERROR "could not create the ambiguous pair: ${mk1} ${mk2}") +endif() + +execute_process(COMMAND ${TOOL} -disp_hdr -infiles ${DIR}/amb + RESULT_VARIABLE rv ERROR_VARIABLE err OUTPUT_VARIABLE out) +if(NOT rv STREQUAL "1") + message(FATAL_ERROR "expected exit 1, got '${rv}'\n${err}") +endif() +if(NOT err MATCHES "Multiple possible filenames") + message(FATAL_ERROR "missing ambiguity diagnostic:\n${err}") +endif() + +# Unambiguous names must still resolve, so that returning NULL +# unconditionally could not pass. +file(REMOVE ${DIR}/amb.nii.gz) +execute_process(COMMAND ${TOOL} -disp_hdr -infiles ${DIR}/amb + RESULT_VARIABLE rv2 ERROR_VARIABLE err2 OUTPUT_VARIABLE out2) +if(NOT rv2 STREQUAL "0") + message(FATAL_ERROR "unambiguous name failed with '${rv2}'\n${err2}") +endif() diff --git a/niftilib/nifti1_io.c b/niftilib/nifti1_io.c index 1f447cbd..60a13198 100644 --- a/niftilib/nifti1_io.c +++ b/niftilib/nifti1_io.c @@ -4315,13 +4315,6 @@ nifti_image *nifti_image_read( const char *hname , int read_data ) /**- convert all nhdr fields to nifti_image fields */ nim = nifti_convert_nhdr2nim(nhdr,hfile); - #ifdef REJECT_COMPLEX - if ((nim->datatype == DT_COMPLEX64) || (nim->datatype == DT_COMPLEX128) || (nim->datatype == DT_COMPLEX256)) { - fprintf(stderr,"Image Exception Unsupported datatype (COMPLEX64): use fslcomplex to manipulate: %s\n", hname); - exit(13); - } - #endif - if( nim == NULL ){ znzclose( fp ) ; /* close the file */ if( g_opts.debug > 0 ) @@ -4330,6 +4323,13 @@ nifti_image *nifti_image_read( const char *hname , int read_data ) return NULL; } + #ifdef REJECT_COMPLEX + if ((nim->datatype == DT_COMPLEX64) || (nim->datatype == DT_COMPLEX128) || (nim->datatype == DT_COMPLEX256)) { + fprintf(stderr,"Image Exception Unsupported datatype (COMPLEX64): use fslcomplex to manipulate: %s\n", hname); + exit(13); + } + #endif + if( g_opts.debug > 3 ){ fprintf(stderr,"+d nifti_image_read(), have nifti image:\n"); nifti_image_infodump(nim); diff --git a/niftilib/testdata/dup_attr.nia b/niftilib/testdata/dup_attr.nia new file mode 100644 index 00000000..ad9932a3 Binary files /dev/null and b/niftilib/testdata/dup_attr.nia differ diff --git a/niftilib/testdata/n1_overflow.nii b/niftilib/testdata/n1_overflow.nii new file mode 100644 index 00000000..a5d8c10b Binary files /dev/null and b/niftilib/testdata/n1_overflow.nii differ diff --git a/niftilib/testdata/n1_volsize.nii b/niftilib/testdata/n1_volsize.nii new file mode 100644 index 00000000..98160d48 Binary files /dev/null and b/niftilib/testdata/n1_volsize.nii differ