SPECTUB segfault when using PSF with 0 intercept #1547
Open
Description
When setting the intercept to zero (which is irrealistic, but can be useful), @varzakis and I see segfaults when the detector is "inside" the image (e.g. for small detector radius). The calc_psf_bin
code doesn't seem to handle the case of a very narrow (or zero width) PSF. Relevant code:
STIR/src/recon_buildblock/SPECTUB_Weight3d.cxx
Lines 681 to 687 in b754fa7
(
di
could be very large/infinite)STIR/src/recon_buildblock/SPECTUB_Weight3d.cxx
Lines 805 to 810 in b754fa7
(
i1
would be undefined but was in our case a very negative number, Ncb
should then be 0, but isn't necessarily)crashes as
i1
is out-of-range
I think this needs 2 modifications:
- if
psref
is very small, just setpsf->val[0] = 1.F;` psf->ind[0] = jm; psf->Nib = 1;
- add an
assert
thati1>=0