Fast-DDS icon indicating copy to clipboard operation
Fast-DDS copied to clipboard

Fix crash in dynamic type registration of primitive type array

Open YangboLong opened this issue 3 years ago • 1 comments

Don't add complete type object in type registration for plain types or EK_MINIMAL types. Otherwise, code like below would result in crash because of null TypeIdentifier pointer. std::vector<uint32_t> lengths = {3}; DynamicType_ptr base_type = DynamicTypeBuilderFactory::get_instance()->create_int32_type(); DynamicTypeBuilder_ptr array = DynamicTypeBuilderFactory::get_instance()->create_array_builder(base_type, lengths); array->set_name("HelloWorld"); ... Domain::registerDynamicType(mp_participant, &m_DynType);

YangboLong avatar Apr 11 '21 19:04 YangboLong

What is the purpose of directory fastrtps_deprecated? I do notice that Domain.cpp sits in this deprecated directory. Does it make sense at all to fix any potential issue in this deprecated directory? Is it going to be replaced as a whole very soon?

YangboLong avatar Apr 11 '21 19:04 YangboLong

@YangboLong sorry for the long delay in answering. fastrtps_deprecated folder has the old PubSub API that was deprecated with Fast DDS v2.0.0. At some point it will be removed and we encourage every user to use the DDS compliant API instead of the old deprecated one. In fact, the examples using the old API were removed this last year and new features are only implemented in the new API.

Nevertheless, it may be interesting to have this fix even though the API will be removed at some point in the future. I am going to assign a milestone in order to review and merge it.

JLBuenoLopez avatar Mar 16 '23 13:03 JLBuenoLopez

@YangboLong sorry for the long delay in answering. fastrtps_deprecated folder has the old PubSub API that was deprecated with Fast DDS v2.0.0. At some point it will be removed and we encourage every user to use the DDS compliant API instead of the old deprecated one. In fact, the examples using the old API were removed this last year and new features are only implemented in the new API.

Nevertheless, it may be interesting to have this fix even though the API will be removed at some point in the future. I am going to assign a milestone in order to review and merge it.

Sure. Let me know if there is anything I can do to contribute to the project.

YangboLong avatar Mar 18 '23 21:03 YangboLong

Thanks @YangboLong for your contribution and sorry for the late reply. I am going to proceed and close this PR because right now, efforts to improve support for XTYPES v1.3 are being made (https://github.com/eProsima/Fast-DDS/pull/3392) which supersedes this PR.

JLBuenoLopez avatar Jun 13 '23 07:06 JLBuenoLopez