public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] libelf: getdata check 64bit values correctly on 32bit arch.
@ 2014-11-16 10:28 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2014-11-16 10:28 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]

On 32bit arches size_t is too small to do size and overflow checks
of 64bit ELF files. Use the actual Elf64 types to make sure checks
on 64bit ELF files are done correctly on 32bit arches.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libelf/ChangeLog     | 5 +++++
 libelf/elf_getdata.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 4fbe94c..4886093 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-16  Mark Wielaard  <mjw@redhat.com>
+
+	* elf_getdata.c (__libelf_set_rawdata_wrlock): Declare offset, size
+	and align as Elf64_Off and Elf64_Xword not size_t.
+
 2014-11-14  Mark Wielaard  <mjw@redhat.com>
 
 	* gelf_getnote.c (gelf_getnote): Check offset overflow.
diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c
index 1ce1e23..0aeb997 100644
--- a/libelf/elf_getdata.c
+++ b/libelf/elf_getdata.c
@@ -170,9 +170,9 @@ int
 internal_function
 __libelf_set_rawdata_wrlock (Elf_Scn *scn)
 {
-  size_t offset;
-  size_t size;
-  size_t align;
+  Elf64_Off offset;
+  Elf64_Xword size;
+  Elf64_Xword align;
   int type;
   Elf *elf = scn->elf;
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-16 10:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-16 10:28 [COMMITTED] libelf: getdata check 64bit values correctly on 32bit arch Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).