diff --git a/include/LIEF/MachO/Binary.hpp b/include/LIEF/MachO/Binary.hpp index 47a43e2b6..8775e7efb 100644 --- a/include/LIEF/MachO/Binary.hpp +++ b/include/LIEF/MachO/Binary.hpp @@ -411,8 +411,9 @@ class LIEF_API Binary : public LIEF::Binary { bool extend_segment(const SegmentCommand& segment, size_t size); /// Extend the **content** of the given Section. - /// @note This method may create a gap between the current section and the next one, if `size` - /// is not multiple of the maximum alignment of sections before the current one. + /// @note This method may extend the section more than `size` preventing creation a gap + /// between the current section and the next one. + /// This may happen trying to satisfy alignment requirement of sections. /// @note This method works only with sections that belong to the first segment. bool extend_section(Section& section, size_t size); diff --git a/src/MachO/Binary.cpp b/src/MachO/Binary.cpp index 58618e87a..2a4665355 100644 --- a/src/MachO/Binary.cpp +++ b/src/MachO/Binary.cpp @@ -1305,7 +1305,7 @@ bool Binary::extend_section(Section& section, size_t size) { } // Extend the given `section`. - section.size(section.size() + size); + section.size(section.size() + shift_value); return true; }