The cost values that get passed to calculateKernel are not guaranteed to be unsigned chars, and therefore can't be guaranteed to be in the range of an unsigned char. This can lead to overflowing the cost variable, which will obviously lead to incorrect kernel computation.
The cost values that get passed to
calculateKernel
are not guaranteed to beunsigned char
s, and therefore can't be guaranteed to be in the range of anunsigned char
. This can lead to overflowing thecost
variable, which will obviously lead to incorrect kernel computation.