File: test_bogus_entry_size.py

package info (click to toggle)
python-pyelftools 0.32-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 68,964 kB
  • sloc: python: 15,903; ansic: 298; asm: 86; makefile: 24; cpp: 18; sh: 4
file content (17 lines) | stat: -rw-r--r-- 642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import unittest
import os
from elftools.common.exceptions import ELFError
from elftools.elf.elffile import ELFFile

class TestSectionHeaderEntrySizeCheck(unittest.TestCase):
    def test_size_check(self):
        test_file = os.path.join('test', 'testfiles_for_unittests', 'section_header_bogus_size.elf')
        with open(test_file, 'rb') as f:
            # This file contains a nonblank section header table and
            # claims header table entry size is zero.
            with self.assertRaises(ELFError):
                elffile = ELFFile(f)
                elffile.has_dwarf_info()

if __name__ == '__main__':
    unittest.main()