Closed tim-lyon closed 1 month ago
Thanks for reporting this. I agree that something like this should never happen.
I will take a look tonight.
Resolved (https://github.com/getml/reflect-cpp/commit/1ff7f762f1f782b4b01d8f1f2a0bd3b112b0ffd4).
Thanks @tim-lyon for bringing this to my attention.
The following code results in an out of bound memory access when reading the json. Occurs when both
Foo
andBar
havestd::array
property of the same name (v
) but the arrays are of different lengths, and the shorter ones appears before the longer one in the variant.I think it should be possible to match the types in this case, as the arrays have fixed length so only one of the types can match.
Using
rfl::TaggedUnion
avoids the issue.