You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:github_user:`Clcanny` improved (see :pr:`507` and :pr:`509`) the reconstruction of the dynamic symbol table
by sorting local symbols and non-exported symbols. It fixes the following warning when parsing
a modified binary with readelf
Warning: local symbol 29 found at index >= .dynsym's sh_info value of 1
MachO:
The API to configure the MachO parser has been redesigned to provide a better granularity
New section about the errors handling (:ref:`err_handling`) and the upcoming
deprecation of the exceptions.
New section about how to compile LIEF for debugging/developing. See: :ref:`lief_debug`
General Design:
span:
LIEF now exposes Section/Segment's data through a span interface.
As std::span is available in the STL from C++20 and the LIEF public API aims at being
C++11 compliant, we expose this span thanks to tcbrindle/span.
This new interface enables to avoid copies of std::vector<uint8_t> which can be costly.
With this new interface, the original std::vector<uint8_t> can be retrieved as follows:
auto bin = LIEF::ELF::Parser::parse("/bin/ls");
if (constauto* section = bin->get_section(".text")) {
LIEF::span<constuint8_t> text_ref = section->content();
std::vector<uint8_t> copy = {std::begin(text_ref), std::end(text_ref)};
}
In Python, span are wrapped by a read-onlymemory view.
The original list of bytes can be retrieved as follows:
We started to refactor the API and the internal design to remove C++ exceptions.
These changes are described a the dedicated blog (LIEF RTTI & Exceptions)
To highlighting the content of the blog for the end users,
functions that returned a reference and which threw an exception in the case
of a failure are now returning a pointer that is set to nullptr in the case of a failure.
LIEF::MachO::Binary& bin = ...;
if (LIEF::MachO::UUIDCommand* cmd = bin.uuid();) {
std::cout << *cmd << "\n";
} else {
// ... dedicated processing as it is a nullptr
}
// Other option with has_uuid()if (bin.has_uuid()) { // It ensures that it is not a nullptr
LIEF::MachO::UUIDCommand& cmd = *bin.uuid();
std::cout << cmd << "\n";
}
.. seealso::
- :ref:`C++ API for errors handling <cpp-api-error-handling>`
- :ref:`Python API for errors handling <python-api-error-handling>`
- `List of the functions that changed <https://gist.github.com/romainthomas/37da45b043c5f8b8db6be2767611f625>`_
Fix missing bound check when computing the authentihash
0.11.3 - March 03, 2021
PE:
Add sanity check on the signature's length that could lead to a std::bad_alloc exception
0.11.2 - February 24, 2021
PE:
Fix regression in the behavior of the PE section's name. One can now access the full
section's name (with trailing bytes) through :attr:`lief.PE.Section.fullname` (see: :issue:`551`)
.. seealso::
:class:`lief.PE.IMPHASH_MODE` and :func:`lief.PE.get_imphash`
Remove the padding entry (0) from the rich header
:attr:`~lief.PE.LangCodeItem.items` now returns a dictionary for which the values are bytes (instead of
str object). This change is related to utf-16 support.
LIEF 0.9 comes with new formats related to Android: OAT, DEX, VDEX and ART. It also fixes bugs and thanks to
:github_user:`yd0b0N`, ELF parser now supports big and little endian binaries. We also completed the JSON serialization of LIEF objects.
fromliefimportto_jsonimportjsonpe=lief.parse("some.exe")
loadconfig=to_json(pe.load_configuration)) # Using the lief.to_json functionpprint(json.loads(to_json(loadconfig)))