diff options
Diffstat (limited to 'libelf/libelf_data.c')
-rw-r--r-- | libelf/libelf_data.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libelf/libelf_data.c b/libelf/libelf_data.c index fcffd8bd9d1c..968394d9bf9a 100644 --- a/libelf/libelf_data.c +++ b/libelf/libelf_data.c @@ -28,7 +28,7 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: libelf_data.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: libelf_data.c 3737 2019-05-05 14:49:50Z jkoshy $"); int _libelf_xlate_shtype(uint32_t sht) @@ -89,8 +89,14 @@ _libelf_xlate_shtype(uint32_t sht) * OS, processor and user-defined section types) are * legal, but since we do not know anything more about * their semantics, we return a type of ELF_T_BYTE. + * + * The ELF specification uses 32 bit unsigned values for + * denoting section types, and defines SHT_HIUSER to be + * 0xFFFFFFFFUL (i.e., UINT32_MAX). Consequently, we only + * need to check that 'sht' is greater than or equal to + * SHT_LOOS. */ - if (sht >= SHT_LOOS && sht <= SHT_HIUSER) + if (sht >= SHT_LOOS) return (ELF_T_BYTE); /* |