Skip to content

Commit

Permalink
Fix key serialization for mutable struct with struct member
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dpotman authored and eboasson committed Sep 11, 2023
1 parent 637cfe5 commit 8fb9d0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cyclonedds/idl/_machinery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ def serialize(self, buffer, value, serialize_kind=SerializeKind.DataSample):
if mutablemember.lentype == LenType.NextIntLen:
buffer.write('I', 4, 0)

mutablemember.machine.serialize(buffer, member_value)
mutablemember.machine.serialize(buffer, member_value, serialize_kind)

if mutablemember.lentype == LenType.NextIntLen:
ampos = buffer.tell()
Expand Down
2 changes: 1 addition & 1 deletion tests/support_modules/fuzz_tools/rand_idl/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Namer:
"annotation", "const", "native", "typedef", "union", "switch", "case", "default",
"enum", "fixed", "string", "sequence", "wstring", "float", "double", "char", "wchar",
"boolean", "bool", "octet", "any", "bitset", "bitmap", "int", "uint", "true", "false",
"del", "class", "not", "def"
"del", "class", "not", "def", "get", "set", "static"
]

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

0 comments on commit 8fb9d0d

Please sign in to comment.