[ub] signed left shifts again

Lawrence Crowl Lawrence at Crowl.org
Wed Nov 13 23:10:32 CET 2013


On 11/13/13, John Regehr <regehr at cs.utah.edu> wrote:
> Ok, I've spent some time looking at open source crypto libraries and
> wrote up some results here:
>
>    http://blog.regehr.org/archives/1054
>
> A good number of these problems will go away once shifting into the sign
> bit is no longer UB, and most of the rest go away once the maintainers
> of 5 packages fix their rotate functions.

It seems that this code also relies on a two's-complement representation.
We already have examples of rare machines that have different behavior.

I have not seen the examples, but is it not the case that casting to unsigned
before the shifts would have created defined behavior?

-- 
Lawrence Crowl


More information about the ub mailing list