Dear developers,
I have found 3 undefined behaviors in readelf.

If you build binutils-2.25 with ubsan (require gcc-4.9 or clang-3.3)
and execute command: readelf -a test_file (test files are in the
attachment).

You will see 3 runtime errors:
readelf.c:1543:39: runtime error: negation of -9223372036854775808 cannot
be represented in type 'bfd_signed_vma' (aka 'long'); cast to an unsigned
type to negate this value to itself
readelf.c:1555:36: runtime error: negation of -9223372036854775808 cannot
be represented in type 'bfd_signed_vma' (aka 'long'); cast to an unsigned
type to negate this value to itself
readelf.c:8374:39: runtime error: signed integer overflow: 8521 -
-9223372036854775112 cannot be represented in type 'long'


Can you please take a look?



-- 
Dingbao Xie

Attachment: ubs.tar.gz
Description: GNU Zip compressed data

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to