bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Negation overflow in readelf.c


From: Dingbao Xie
Subject: Fwd: Negation overflow in readelf.c
Date: Sun, 19 Jul 2015 13:46:00 -0700

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]