]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Fix undefined left shift with signed ints 30/head
authorSean McBride <sean@rogue-research.com>
Thu, 29 Nov 2012 23:20:11 +0000 (18:20 -0500)
committerBrad King <brad.king@kitware.com>
Fri, 30 Nov 2012 13:06:58 +0000 (08:06 -0500)
commitcf0f28ad3c13c7dc964b120e336cc802b20b442b
tree059d58465817469f7456d51e6b9493c865c1a28c
parent39df0279539b519ad83ae12a5dedd50e6ecdc5d1
Fix undefined left shift with signed ints

Caught by Clang's -fsanitize=shift.  A small unsigned int was promoted,
according to C's regular promotion rules, to a signed int, it was then
left shifted.  This sometimes pushed a 1 into the sign bit, which is
undefined behaviour.  Fix by using unsigned temporaries.
libarchive/archive_endian.h