Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qos.transport().transport_type is not initialized but used #4692

Open
1 task done
firmianay opened this issue Apr 17, 2024 · 0 comments
Open
1 task done

qos.transport().transport_type is not initialized but used #4692

firmianay opened this issue Apr 17, 2024 · 0 comments
Labels
triage Issue pending classification

Comments

@firmianay
Copy link

Is there an already existing issue for this?

  • I have searched the existing issues

Expected behavior

...

Current behavior

Found when scanning with Coverity, qos.transport().transport_type does not seem to be initialized, which may cause problems such as crash. When xml_config_file_.length() <= 0U, it will enter create_participant().
https://wiki.sei.cmu.edu/confluence/display/cplusplus/EXP53-CPP.+Do+not+read+uninitialized+memory

bool OnlineLogSubscriber::init(const std::string& xml_config_file) {
    // CREATE THE PARTICIPANT
    DomainParticipantQos pqos;
    pqos.name("Participant_sub");

    /* Create DomainParticipant*/
    std::string participant_profile_name = "sub_participant_profile";
    xml_config_file_                     = xml_config_file;
    // Load XML configuration
    if (xml_config_file_.length() > 0U) {
        if (ReturnCode_t::RETCODE_OK != DomainParticipantFactory::get_instance()->get_participant_qos_from_profile(
                                            participant_profile_name, pqos)) {
            return false;
        }
    }

    participant_ = DomainParticipantFactory::get_instance()->create_participant(log_doamin_, pqos);
DomainParticipant* DomainParticipantFactory::create_participant(DomainId_t did, const DomainParticipantQos& qos,
                                                                DomainParticipantListener* listen,
                                                                const StatusMask& mask) {
...

    const DomainParticipantQos& pqos = (&qos == &PARTICIPANT_QOS_DEFAULT) ? default_participant_qos_ : qos;

    logInfo(PARTICIPANT, "PARTICIPANT_QOS_DEFAULT.transport_type:"
                             << PARTICIPANT_QOS_DEFAULT.transport().transport_type
                             << " default_participant_qos_.transport().transport_type:"
                             << default_participant_qos_.transport().transport_type
                             << " qos.transport().transport_type:" << qos.transport().transport_type
                             << " pqos.transport().transport_type:" << pqos.transport().transport_type
                             << " equal?:" << (&qos == &PARTICIPANT_QOS_DEFAULT));

Steps to reproduce

...

Fast DDS version/commit

...

Platform/Architecture

Ubuntu Focal 20.04 amd64

Transport layer

Default configuration, UDPv4 & SHM

Additional context

No response

XML configuration file

No response

Relevant log output

No response

Network traffic capture

No response

@firmianay firmianay added the triage Issue pending classification label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Issue pending classification
Projects
None yet
Development

No branches or pull requests

1 participant