I discovered an array overflow in resample_volume's trilinear_interpolant() while running mincresample on an input volume with a slice dimension size of one. It attempts to read from index slcind+1here but volume->offset is created with a size of 1
here.
I believe the intended behaviour was to use slcnext (set to 0 when the dimension is of size 1 here ) rather than slcind+1 as an index.
The exact output is undefined and from what I can see depends on your system but running the mincresample call with valgrind should complain about an invalid read.
I discovered an array overflow in resample_volume's trilinear_interpolant() while running mincresample on an input volume with a slice dimension size of one. It attempts to read from index
slcind+1
here butvolume->offset
is created with a size of 1 here. I believe the intended behaviour was to useslcnext
(set to 0 when the dimension is of size 1 here ) rather thanslcind+1
as an index.To reproduce it:
The exact output is undefined and from what I can see depends on your system but running the mincresample call with valgrind should complain about an invalid read.
I'll open a PR if that fix sounds correct to you.