summaryrefslogtreecommitdiff
path: root/libelf
diff options
context:
space:
mode:
Diffstat (limited to 'libelf')
-rw-r--r--libelf/_libelf_config.h8
-rw-r--r--libelf/elf.33
-rw-r--r--libelf/elf_scn.c8
-rw-r--r--libelf/libelf_ar_util.c6
-rw-r--r--libelf/libelf_convert.m412
5 files changed, 22 insertions, 15 deletions
diff --git a/libelf/_libelf_config.h b/libelf/_libelf_config.h
index b9442fdc81d06..45d8714b2ae6e 100644
--- a/libelf/_libelf_config.h
+++ b/libelf/_libelf_config.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _libelf_config.h 2287 2011-12-04 06:45:47Z jkoshy $
+ * $Id: _libelf_config.h 3143 2015-02-15 17:57:38Z emaste $
*/
#ifdef __DragonFly__
@@ -53,6 +53,12 @@
#define LIBELF_BYTEORDER ELFDATA2LSB
#define LIBELF_CLASS ELFCLASS64
+#elif defined(__aarch64__)
+
+#define LIBELF_ARCH EM_AARCH64
+#define LIBELF_BYTEORDER ELFDATA2LSB
+#define LIBELF_CLASS ELFCLASS64
+
#elif defined(__arm__)
#define LIBELF_ARCH EM_ARM
diff --git a/libelf/elf.3 b/libelf/elf.3
index 97677eb205d66..618b4f7d92ab6 100644
--- a/libelf/elf.3
+++ b/libelf/elf.3
@@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elf.3 3082 2014-07-28 09:13:33Z jkoshy $
+.\" $Id: elf.3 3142 2015-01-29 23:11:14Z jkoshy $
.\"
.Dd July 28, 2014
.Os
@@ -413,7 +413,6 @@ Section types in the range
.Dv SHT_HIUSER ]
are otherwise considered to be of type
.Dv ELF_T_BYTE .
-.TE
.Ss Functional Grouping
This section contains a brief overview of the available functionality
in the ELF library.
diff --git a/libelf/elf_scn.c b/libelf/elf_scn.c
index f80711579d597..f07f6ae9ea16b 100644
--- a/libelf/elf_scn.c
+++ b/libelf/elf_scn.c
@@ -36,7 +36,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_scn.c 3013 2014-03-23 06:16:59Z jkoshy $");
+ELFTC_VCSID("$Id: elf_scn.c 3147 2015-02-15 18:45:23Z emaste $");
/*
* Load an ELF section table and create a list of Elf_Scn structures.
@@ -59,8 +59,10 @@ _libelf_load_section_headers(Elf *e, void *ehdr)
assert((e->e_flags & LIBELF_F_SHDRS_LOADED) == 0);
#define CHECK_EHDR(E,EH) do { \
- if (fsz != (EH)->e_shentsize || \
- shoff + fsz * shnum > e->e_rawsize) { \
+ if (shoff > e->e_rawsize || \
+ fsz != (EH)->e_shentsize || \
+ shnum > SIZE_MAX / fsz || \
+ fsz * shnum > e->e_rawsize - shoff) { \
LIBELF_SET_ERROR(HEADER, 0); \
return (0); \
} \
diff --git a/libelf/libelf_ar_util.c b/libelf/libelf_ar_util.c
index 7e6ec4068f691..7b824fb579a90 100644
--- a/libelf/libelf_ar_util.c
+++ b/libelf/libelf_ar_util.c
@@ -34,7 +34,7 @@
#include "_libelf.h"
#include "_libelf_ar.h"
-ELFTC_VCSID("$Id: libelf_ar_util.c 3013 2014-03-23 06:16:59Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_ar_util.c 3157 2015-02-15 21:42:02Z emaste $");
/*
* Convert a string bounded by `start' and `start+sz' (exclusive) to a
@@ -278,8 +278,8 @@ _libelf_ar_open(Elf *e, int reporterror)
* Handle special archive members for the SVR4 format.
*/
if (arh.ar_name[0] == '/') {
-
- assert(sz > 0);
+ if (sz == 0)
+ goto error;
e->e_flags |= LIBELF_F_AR_VARIANT_SVR4;
diff --git a/libelf/libelf_convert.m4 b/libelf/libelf_convert.m4
index fc9cf394a24d4..f400367c36199 100644
--- a/libelf/libelf_convert.m4
+++ b/libelf/libelf_convert.m4
@@ -32,7 +32,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_convert.m4 3009 2014-03-23 01:49:59Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_convert.m4 3158 2015-02-15 21:42:07Z emaste $");
/* WARNING: GENERATED FROM __file__. */
@@ -1007,6 +1007,11 @@ _libelf_cvt_NOTE_tof(unsigned char *dst, size_t dsz, unsigned char *src,
descsz = en->n_descsz;
type = en->n_type;
+ sz = namesz;
+ ROUNDUP2(sz, 4U);
+ sz += descsz;
+ ROUNDUP2(sz, 4U);
+
SWAP_WORD(namesz);
SWAP_WORD(descsz);
SWAP_WORD(type);
@@ -1017,11 +1022,6 @@ _libelf_cvt_NOTE_tof(unsigned char *dst, size_t dsz, unsigned char *src,
src += sizeof(Elf_Note);
- ROUNDUP2(namesz, 4U);
- ROUNDUP2(descsz, 4U);
-
- sz = namesz + descsz;
-
if (count < sz)
sz = count;