Exemplo n.º 1
0
    def test_replace_section(self):
        elf_from = UnpreparedElfFile()
        elf_to = UnpreparedElfFile()

        seg = SectionedElfSegment(elf_from, sections=[UnpreparedElfSection(elf_from, "test")])
        old_section = seg.get_sections()[0]
        new_section = UnpreparedElfSection(elf_to, "new")
        seg.replace_section(old_section, new_section)
        self.assertEqual(seg.get_sections(), [new_section])
        new_seg = seg.copy_into(elf_to)

        self.assertRaises(InvalidArgument, seg.replace_section, None, new_section)