Skip to content

Commit 8fb9d0d

Browse files
dpotmaneboasson
authored andcommitted
Fix key serialization for mutable struct with struct member
This fixes the serialization of keys for a mutable struct that has a key member with a struct type that contains non-key members. The serialization kind was not passed to the nested serialize call, which resulted in non-key members of the nested type being added to the key. Additionally a few entries are added to the reserved name list in the random IDL generator. This solves some runtime errors in fuzzer runs (`TypeError: 'list' object is not callable` and `expected identifier or '(' before 'static'`) Signed-off-by: Dennis Potman <[email protected]>
1 parent 637cfe5 commit 8fb9d0d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cyclonedds/idl/_machinery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ def serialize(self, buffer, value, serialize_kind=SerializeKind.DataSample):
10381038
if mutablemember.lentype == LenType.NextIntLen:
10391039
buffer.write('I', 4, 0)
10401040

1041-
mutablemember.machine.serialize(buffer, member_value)
1041+
mutablemember.machine.serialize(buffer, member_value, serialize_kind)
10421042

10431043
if mutablemember.lentype == LenType.NextIntLen:
10441044
ampos = buffer.tell()

tests/support_modules/fuzz_tools/rand_idl/naming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Namer:
1818
"annotation", "const", "native", "typedef", "union", "switch", "case", "default",
1919
"enum", "fixed", "string", "sequence", "wstring", "float", "double", "char", "wchar",
2020
"boolean", "bool", "octet", "any", "bitset", "bitmap", "int", "uint", "true", "false",
21-
"del", "class", "not", "def"
21+
"del", "class", "not", "def", "get", "set", "static"
2222
]
2323

2424
def __init__(self, seed, prefix, parent=None) -> None:

0 commit comments

Comments
 (0)