Ejemplo n.º 1
0
    def CheckEntries(self):
        """Check that entries do not overlap or extend outside the section

        This also sorts entries, if needed and expands
        """
        if self._sort:
            self._SortEntries()
        self._ExpandEntries()
        offset = 0
        prev_name = 'None'
        for entry in self._entries.values():
            entry.CheckOffset()
            if (entry.offset < self._skip_at_start or entry.offset + entry.size
                    > self._skip_at_start + self._size):
                entry.Raise("Offset %#x (%d) is outside the section starting "
                            "at %#x (%d)" %
                            (entry.offset, entry.offset, self._skip_at_start,
                             self._skip_at_start))
            if entry.offset < offset:
                entry.Raise(
                    "Offset %#x (%d) overlaps with previous entry '%s' "
                    "ending at %#x (%d)" %
                    (entry.offset, entry.offset, prev_name, offset, offset))
            offset = entry.offset + entry.size
            prev_name = entry.GetPath()
Ejemplo n.º 2
0
 def CheckEntries(self):
     """Check that entries do not overlap or extend outside the image"""
     if self._sort:
         self._SortEntries()
     pos = 0
     prev_name = 'None'
     for entry in self._entries.values():
         if (entry.pos < self._skip_at_start
                 or entry.pos >= self._skip_at_start + self._size):
             entry.Raise("Position %#x (%d) is outside the image starting "
                         "at %#x (%d)" %
                         (entry.pos, entry.pos, self._skip_at_start,
                          self._skip_at_start))
         if entry.pos < pos:
             entry.Raise(
                 "Position %#x (%d) overlaps with previous entry '%s' "
                 "ending at %#x (%d)" %
                 (entry.pos, entry.pos, prev_name, pos, pos))
         pos = entry.pos + entry.size
         prev_name = entry.GetPath()