Commit Graph

13 Commits

Author SHA1 Message Date
Serge Lamikhov-Center
453929342f Don't access a note entry in case namesz is less than 1 2020-05-29 05:26:43 -07:00
Vašek Potoček
972f89e022 Better support for read-only ELF access 2017-10-04 20:33:10 +03:00
Tobias Klauser
446e0c215c elfio_note: fix MSVC compiler warning
Fix the following MSVC compiler warning:

elfio/elfio_note.hpp(77): warning C4267: 'initializing' : conversion from 'size_t' to 'ELFIO::Elf_Word', possible loss of data

by changing the type of max_name_sizei to Elf_Xword, as
note_secton->get_size() returns Elf_Xword and note_start_positions also
contains members of type Elf_Xword.
2016-10-06 12:07:20 +02:00
Tobias Klauser
af4140a122 elfio: don't cast away const qualifiers
Don't cast away const qualifiers when accessing const data (e.g. section
data). This fixes the warnings such as the following when compiling with
GCC and the -Wcast-qual flag set:

warning: cast from type ‘const char*’ to type ‘ELFIO::Elf_Word* {aka unsigned int*}’ casts away qualifiers [-Wcast-qual]
2016-09-22 23:22:39 +03:00
Serge Lamikhov-Center
3c5620d46d Make note section entries for 64-bit ELF file be the same as for 32-bit file
There are discrepancies in documentations. SCO documentation
(http://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section)
requires 8 byte entries alignment for 64-bit ELF file,
but Oracle's definition uses the same structure
for 32-bit and 64-bit formats.
(https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-18048.html)

It looks like EM_X86_64 Linux implementation is similar to Oracle's
definition. Therefore, the same alignment works for both formats
2016-07-10 11:35:23 +03:00
Kevin Klues
e3e0d6dbdb Fixed off-by-one error in 'name' of add_note() function.
Previously, when assigning 'name' as a string, it's length was specified
using the full length of 'namesz'. However, this length includes the
trailing '\0' of the underlying char[]. This ultimately causes the C++
string that is created to (incorrectly) contain the '\0' character as
well. This leads to problems where e.g. the following will return false,
even when 'name' itself actually contains the string "GNU\0":

  if (name == "GNU") {
    return true;
  }
  return false;

To fix this, we should only include the length of the string minus the
trailing '\0'.
2016-07-02 11:02:20 -07:00
Serge Lamikhov-Center
5ec1fc8949 Prevent a crash when working with MN10300 ELF file 2015-02-25 00:57:51 +02:00
Serge Lamikhov-Center
9e4502d90e Copyright year update 2015-02-13 20:51:07 +02:00
Serge Lamikhov-Center
b78c0aca3d Convert all files to UNIX EOL 2012-11-27 11:45:28 +02:00
Serge Lamikhov-Center
b74f44443d 'add_entry' in symbol_section_accessor was renamed to 'add_symbol'
documentation update
<elfio.hpp> was modified to be <elfio/elfio.hpp>
2012-11-25 19:58:07 +02:00
Serge Lamikhov-Center
3203483e34 Prevent compilation warnings when compiled x64 target with VS2008 2012-07-24 12:10:16 +03:00
Serge Lamikhov-Center
e1d554978d Trim trailing space and remove tabs 2012-06-24 09:02:32 +03:00
Serge Lamikhov-Center
493549e030 Initial 2012-02-18 12:01:36 +02:00