dissect.cstruct 3.11.dev3__tar.gz → 3.12.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dissect.cstruct-3.11.dev3/dissect.cstruct.egg-info → dissect.cstruct-3.12.dev2}/PKG-INFO +1 -1
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/structure.py +7 -1
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2/dissect.cstruct.egg-info}/PKG-INFO +1 -1
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_align.py +15 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/COPYRIGHT +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/LICENSE +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/MANIFEST.in +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/README.md +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/__init__.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/bitbuffer.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/compiler.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/cstruct.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/exceptions.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/expression.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/parser.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/__init__.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/base.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/bytesinteger.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/chartype.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/enum.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/flag.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/instance.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/packedtype.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/pointer.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/voidtype.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/wchartype.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/utils.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect.cstruct.egg-info/SOURCES.txt +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect.cstruct.egg-info/dependency_links.txt +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect.cstruct.egg-info/top_level.txt +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/examples/disk.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/examples/mirai.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/examples/pe.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/examples/secdesc.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/pyproject.toml +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/setup.cfg +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/__init__.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/conftest.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/data/testdef.txt +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/docs/Makefile +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/docs/conf.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/docs/index.rst +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_basic.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_bitbuffer.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_bitfield.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_bytesinteger.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_ctypes_type.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_enum.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_expression.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_flag.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_packedtype.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_parser.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_pointer.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_struct.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_union.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_util.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/test_utils.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tests/utils.py +0 -0
- {dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dissect.cstruct
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.12.dev2
|
|
4
4
|
Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -22,7 +22,7 @@ class Field:
|
|
|
22
22
|
self.alignment = type_.alignment
|
|
23
23
|
|
|
24
24
|
def __repr__(self):
|
|
25
|
-
bits_str = " : {self.bits}" if self.bits else ""
|
|
25
|
+
bits_str = f" : {self.bits}" if self.bits else ""
|
|
26
26
|
return f"<Field {self.name} {self.type}{bits_str}>"
|
|
27
27
|
|
|
28
28
|
|
|
@@ -324,6 +324,12 @@ class Union(Structure):
|
|
|
324
324
|
size = max(len(field.type), size)
|
|
325
325
|
alignment = max(field.alignment, alignment)
|
|
326
326
|
|
|
327
|
+
if self.align and size is not None:
|
|
328
|
+
# Add "tail padding" if we need to align
|
|
329
|
+
# This bit magic rounds up to the next alignment boundary
|
|
330
|
+
# E.g. offset = 3; alignment = 8; -offset & (alignment - 1) = 5
|
|
331
|
+
size += -size & (alignment - 1)
|
|
332
|
+
|
|
327
333
|
self.size = size
|
|
328
334
|
self.alignment = alignment
|
|
329
335
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dissect.cstruct
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.12.dev2
|
|
4
4
|
Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -72,6 +72,21 @@ def test_align_union():
|
|
|
72
72
|
assert obj.dumps() == buf
|
|
73
73
|
|
|
74
74
|
|
|
75
|
+
def test_align_union_tail():
|
|
76
|
+
d = """
|
|
77
|
+
union test {
|
|
78
|
+
uint64 a;
|
|
79
|
+
uint32 b[3];
|
|
80
|
+
};
|
|
81
|
+
"""
|
|
82
|
+
c = cstruct.cstruct()
|
|
83
|
+
c.load(d, align=True)
|
|
84
|
+
|
|
85
|
+
assert c.test.align
|
|
86
|
+
assert c.test.alignment == 8
|
|
87
|
+
assert c.test.size == 16
|
|
88
|
+
|
|
89
|
+
|
|
75
90
|
def test_align_array():
|
|
76
91
|
d = """
|
|
77
92
|
struct test {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect/cstruct/types/bytesinteger.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect.cstruct.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dissect.cstruct-3.11.dev3 → dissect.cstruct-3.12.dev2}/dissect.cstruct.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|