From 24d48ad0b50587dd67e8b9c36232036503c572b9 Mon Sep 17 00:00:00 2001 From: Romain Thomas Date: Sat, 27 Jul 2024 21:01:04 +0200 Subject: [PATCH] Fix Mach-O issue --- api/python/lief/ELF.pyi | 2 +- include/LIEF/MachO/LoadCommand.hpp | 2 ++ src/MachO/Binary.cpp | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/python/lief/ELF.pyi b/api/python/lief/ELF.pyi index a374cfbbb..4f7f93725 100644 --- a/api/python/lief/ELF.pyi +++ b/api/python/lief/ELF.pyi @@ -1056,8 +1056,8 @@ class DynamicEntry(lief.Object): VERNEEDNUM: ClassVar[DynamicEntry.TAG] = ... VERSYM: ClassVar[DynamicEntry.TAG] = ... X86_64_PLT: ClassVar[DynamicEntry.TAG] = ... - X86_64_PLTSZ: ClassVar[DynamicEntry.TAG] = ... X86_64_PLTENT: ClassVar[DynamicEntry.TAG] = ... + X86_64_PLTSZ: ClassVar[DynamicEntry.TAG] = ... __name__: str def __init__(self, *args, **kwargs) -> None: ... @staticmethod diff --git a/include/LIEF/MachO/LoadCommand.hpp b/include/LIEF/MachO/LoadCommand.hpp index e0bd64226..8ce61ac47 100644 --- a/include/LIEF/MachO/LoadCommand.hpp +++ b/include/LIEF/MachO/LoadCommand.hpp @@ -27,6 +27,7 @@ namespace LIEF { namespace MachO { class Builder; class BinaryParser; +class Binary; namespace details { struct load_command; @@ -36,6 +37,7 @@ struct load_command; class LIEF_API LoadCommand : public Object { friend class Builder; friend class BinaryParser; + friend class Binary; public: using raw_t = std::vector; diff --git a/src/MachO/Binary.cpp b/src/MachO/Binary.cpp index 816e952d9..775867510 100644 --- a/src/MachO/Binary.cpp +++ b/src/MachO/Binary.cpp @@ -1196,6 +1196,7 @@ bool Binary::extend(const LoadCommand& command, uint64_t size) { } cmd->size(size_aligned); + cmd->original_data_.resize(size_aligned); // Update Header // =============