]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR22245, Fix potential UB in bfd_set_error
authorPavel I. Kryukov <kryukov@frtk.ru>
Tue, 3 Oct 2017 19:42:07 +0000 (22:42 +0300)
committerAlan Modra <amodra@gmail.com>
Wed, 4 Oct 2017 04:02:38 +0000 (14:32 +1030)
commit99ca76d3db25af8e017d7d54df677db0561907f5
tree38609ff247e007df8ac2679fd49661293c8fa55d
parentc8dfbe853b7f8e86fa0352034458829bf8a297b6
PR22245, Fix potential UB in bfd_set_error

Passing enum as a first argument to variadic argument function
may lead to undefined behavior. The explanation on CERT site:
https://www.securecoding.cert.org/confluence/display/cplusplus/
EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start

The bug was found by Kirill Nedostoev (nedostoev.ka@phystech.edu)
when he tried to build GNU binutils with Clang 7.

PR 22245
* bfd.c (bfd_set_error): Avoid UB on passing arg to va_start that
undergoes default promotion.
* bfd-in2.h: Regenerate.

(cherry picked from commit 9ba5f27cdd15d22d6c5739ff5d2b1c81d796e114)
bfd/ChangeLog
bfd/bfd-in2.h
bfd/bfd.c