summaryrefslogtreecommitdiff
path: root/soltools/adjustvisibility
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2006-06-20 04:05:35 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2006-06-20 04:05:35 +0000
commitbd6da379e5ac592916ea91433eeeb748bb625ddb (patch)
tree722eae820fd2c4dab4b8bc332973c6cbfb9fb154 /soltools/adjustvisibility
parenta12358831fb773014b2fabebe5c271524e0e6b5c (diff)
INTEGRATION: CWS warnings01 (1.2.28); FILE MERGED
2005/09/23 02:10:59 sb 1.2.28.2: RESYNC: (1.2-1.3); FILE MERGED 2005/08/29 13:36:15 sb 1.2.28.1: #i53898# Made code warning-free.
Diffstat (limited to 'soltools/adjustvisibility')
-rw-r--r--soltools/adjustvisibility/adjustvisibility.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/soltools/adjustvisibility/adjustvisibility.cxx b/soltools/adjustvisibility/adjustvisibility.cxx
index 4932bcfa3911..8b42838bf9c0 100644
--- a/soltools/adjustvisibility/adjustvisibility.cxx
+++ b/soltools/adjustvisibility/adjustvisibility.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: adjustvisibility.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 07:22:24 $
+ * last change: $Author: hr $ $Date: 2006-06-20 05:05:35 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -54,6 +54,7 @@
#include <utime.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <limits>
// Note: There is no GELF_ST_VISIBILITY macro in gelf.h, we roll our own.
#define GELF_ST_VISIBILITY(o) ((o)&0x3) // See "Linker and Libraries Guide".
@@ -165,8 +166,12 @@ void adjustVisibility( const std::string& rFile, int fd, bool bVerbose)
throw ElfError(rFile, "elf_getdata() failed");
}
// Iterate over symbol table.
- unsigned int nSymbols = aShdr.sh_size / aShdr.sh_entsize;
- for ( unsigned int nIndex = 0; nIndex < nSymbols; ++nIndex) {
+ GElf_Xword nSymbols = aShdr.sh_size / aShdr.sh_entsize;
+ if ( nSymbols > std::numeric_limits< int >::max() )
+ {
+ throw ElfError(rFile, "too many symbols");
+ }
+ for ( int nIndex = 0; nIndex < nSymbols; ++nIndex) {
// Get symbol.
GElf_Sym aSymbol;
if ( gelf_getsym(pSymbolData, nIndex, &aSymbol) == NULL )