Closed pmatos closed 5 years ago
A few shift lefts cause ub because of (1 << n) where n is 31. The constant 1 is signed causing ub. Initially my fix was to do (1U << n) however, I have seen the pattern ((U32)1 << n) elsewhere in the file so decided to follow this.
(1 << n)
n
(1U << n)
((U32)1 << n)
Caught by ubsan racketcs.
A few shift lefts cause ub because of
(1 << n)
wheren
is 31. The constant 1 is signed causing ub. Initially my fix was to do(1U << n)
however, I have seen the pattern((U32)1 << n)
elsewhere in the file so decided to follow this.Caught by ubsan racketcs.