# How to prevent (or remove) aliasing when a cross-correlation between spectra is performed

This is my problem: I'm implementing a tool which cross-correlates a spectrum (fluxes as function of wavelength, obtained directly from an instrument) with a template (fluxes as function of wavelength, obtained by stacking observations). In order to perform such operation I have to dilate the template by multiplying the wavelength by a factor $$(1+z)$$ where $$z$$ is a floating value whose range is manually set (typically could be something like $$[2.0, 2.5]$$, always less than $$7$$). After the dilation, I have to resample this modified template so that it shares with the spectrum the same sampling (an upsampling).
This tool is actually working with $$z<4$$, for values of $$z$$ larger than this threshold I found there is a sort of aliasing effect.

Be honest, I'm not sure that it is aliasing, but looking the cross-correlation function, it shows the presence of something that looks like an aliasing effect: in the figure there are some results, in each plot, upper panel is the spectrum, bottom panel the cross-correlation function (the blue line is centered on the peak of this function, while the red line is the "true" value; but these lines are not important)

Now, these results are confusing me since I don't understand how to manage these oscillations in a spectral domain. How can I prevent this mechanism? Or how can I remove these "frequencies"?