Hello John,
I found a bug in MatWaveDwt.cpp with uninitialized values.
It's at the idwt_template() function, about the last element of cDTemp array when cD was originally in odd length.
Use an example of input array with length 19. After forward transform, cA has length 10, and cD has length 9. Then we enter the idwt_template() function.
Given the bior4.4 wavelet kernel and all the boundary extensions considered, in
line 732, extendLen = 2;
line 735, cATempLen = 14;
line 739, cDTempLen = 14.
cDTemp is allocated memory of length 14 in line 747 as well.
cDTemp is then extended from cD at line 788. Note cD has size 9, and is extended to size (9+2+2)=13 at the place where cDTemp is pointing to. However, cDTemp is later used as if it has length cDTempLen=14 in inverse_xform_odd(), though the 14th element is never initialized.
I think an easy fix could be adding the following code after line 792:
if( L[1] + extendLen + extendLen < cDTempLen )
{
assert( L[1] + extendLen + extendLen == cDTempLen - 1 );
cDTemp[ cDTempLen-1 ] = 0.0;
}
Thanks,
Samuel
Thanks, Samuel. We’ll get this taken care of for the next release.
jc
John Clyne
National Center for Atmospheric Research
303.497.1236 (w), 303.809.1922 (c)
clyne@ucar.edu
Related
Bugs:
#1267