MCPcopy Index your code
hub / github.com/RustPython/RustPython / OffsetValidationTests

Class OffsetValidationTests

Lib/test/test_tarfile.py:4669–4821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4667
4668
4669class OffsetValidationTests(unittest.TestCase):
4670 tarname = tmpname
4671 invalid_posix_header = (
4672 # name: 100 bytes
4673 tarfile.NUL * tarfile.LENGTH_NAME
4674 # mode, space, null terminator: 8 bytes
4675 + b"000755" + SPACE + tarfile.NUL
4676 # uid, space, null terminator: 8 bytes
4677 + b"000001" + SPACE + tarfile.NUL
4678 # gid, space, null terminator: 8 bytes
4679 + b"000001" + SPACE + tarfile.NUL
4680 # size, space: 12 bytes
4681 + b"\xff" * 11 + SPACE
4682 # mtime, space: 12 bytes
4683 + tarfile.NUL * 11 + SPACE
4684 # chksum: 8 bytes
4685 + b"0011407" + tarfile.NUL
4686 # type: 1 byte
4687 + tarfile.REGTYPE
4688 # linkname: 100 bytes
4689 + tarfile.NUL * tarfile.LENGTH_LINK
4690 # magic: 6 bytes, version: 2 bytes
4691 + tarfile.POSIX_MAGIC
4692 # uname: 32 bytes
4693 + tarfile.NUL * 32
4694 # gname: 32 bytes
4695 + tarfile.NUL * 32
4696 # devmajor, space, null terminator: 8 bytes
4697 + tarfile.NUL * 6 + SPACE + tarfile.NUL
4698 # devminor, space, null terminator: 8 bytes
4699 + tarfile.NUL * 6 + SPACE + tarfile.NUL
4700 # prefix: 155 bytes
4701 + tarfile.NUL * tarfile.LENGTH_PREFIX
4702 # padding: 12 bytes
4703 + tarfile.NUL * 12
4704 )
4705 invalid_gnu_header = (
4706 # name: 100 bytes
4707 tarfile.NUL * tarfile.LENGTH_NAME
4708 # mode, null terminator: 8 bytes
4709 + b"0000755" + tarfile.NUL
4710 # uid, null terminator: 8 bytes
4711 + b"0000001" + tarfile.NUL
4712 # gid, space, null terminator: 8 bytes
4713 + b"0000001" + tarfile.NUL
4714 # size, space: 12 bytes
4715 + b"\xff" * 11 + SPACE
4716 # mtime, space: 12 bytes
4717 + tarfile.NUL * 11 + SPACE
4718 # chksum: 8 bytes
4719 + b"0011327" + tarfile.NUL
4720 # type: 1 byte
4721 + tarfile.REGTYPE
4722 # linkname: 100 bytes
4723 + tarfile.NUL * tarfile.LENGTH_LINK
4724 # magic: 8 bytes
4725 + tarfile.GNU_MAGIC
4726 # uname: 32 bytes

Callers

nothing calls this directly

Calls 1

tobufMethod · 0.80

Tested by

no test coverage detected