Check well-formedness of CDR before extracting key
The python serializer doesn't detect that in:
enum E { A, B, C }
union T switch(E) { ... }
union U switch(boolean) { case true: T value }
struct S { U m }
write (S(m=T(discriminant=B, value=...)))
there's an entire union missing in the value to be written, and because it can't find "B"
in the list of labels in U (i.e., "B" is not in "[True]") it serializes "B" and skips
"value". It so happens that "B"'s serialization matches that of "True" (on a little
endian machine, but there are variants where endianness doesn't matter), and so
"dds_stream_extract_key" will take the "true" case and try to deserialize T. It doesn't
handle malformed input, so bad things happen.
I don't know how to prevent this type confusion in the Python serializer, but I do know
how to check for malformed input.
Signed-off-by: Erik Boasson <eb@ilities.com> E
Erik Boasson committed
0add6e53370b61012f4cc109a5abbc1448948955
Parent: 8298593