Skip to content
Merged
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
8 changes: 8 additions & 0 deletions nifti2/nifti2_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -5036,6 +5036,14 @@ nifti_image* nifti_convert_n2hdr2nim(nifti_2_header nhdr, const char * fname)
ERREX("bad datatype") ;
}

/* dim[0] is the number of dimensions and the loops below index dim[]
with it; the NIFTI-1 path gets this check from need_nhdr_swap() */
if( nhdr.dim[0] < 0 || nhdr.dim[0] > 7 )
{
free(nim);
ERREX("bad dim[0]") ;
}

if( nhdr.dim[1] <= 0 )
{
free(nim);
Expand Down
Loading