]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gold/binary.cc
PR24435, buffer overflow reading dynamic entries
[thirdparty/binutils-gdb.git] / gold / binary.cc
index a933b2d475df8afac3aa8ef6023fd6e4bcee2135..31e585f4ecd38ddccafdd74edf1a48a5f6944010 100644 (file)
@@ -1,6 +1,6 @@
 // binary.cc -- binary input files for gold
 
-// Copyright (C) 2008-2014 Free Software Foundation, Inc.
+// Copyright (C) 2008-2019 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -24,7 +24,6 @@
 
 #include <cerrno>
 #include <cstring>
-#include "safe-ctype.h"
 
 #include "elfcpp.h"
 #include "stringpool.h"
 #include "output.h"
 #include "binary.h"
 
+// safe-ctype.h interferes with macros defined by the system <ctype.h>.
+// Some C++ system headers might include <ctype.h> and rely on its macro
+// definitions being intact.  So make sure that safe-ctype.h is included
+// only after any C++ system headers, whether directly here (above) or via
+// other local header files (e.g. #include <string> in "binary.h").
+#include "safe-ctype.h"
+
 // Support for reading binary files as input.  These become blobs in
 // the final output.  These files are treated as though they have a
 // single .data section and define three symbols: