malformed elf causes invalid shiftleft in readelf -S with ubsan

Hanno Böck hanno at hboeck.de
Sun Jan 25 19:42:03 UTC 2015


Hi,

When compiling elfutils with undefined behaviour sanitizer
(-fsanitize=undefined) a warning will be shown indicating an invalid
shiftleft operation on the attached elf file:

readelf.c:1133:28: runtime error: left shift of 1 by 31 places cannot
be represented in type 'int'

Tested with elfutils-0.161. This was found with zzuf.

cu,
-- 
Hanno Böck
http://hboeck.de/

mail/jabber: hanno at hboeck.de
GPG: BBB51E42
-------------- next part --------------
A non-text attachment was scrubbed...
Name: readelf-S-invalid-left-shift
Type: application/octet-stream
Size: 856 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20150125/faabd9dc/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20150125/faabd9dc/attachment.sig>


More information about the elfutils-devel mailing list