Skip to content

libcosim crashes when FMUs log messages using a NULL category #796

@kyllingstad

Description

@kyllingstad

If an FMU calls the logger callback provided by libcosim with a null category argument, the process will segfault. This is because of the following statement in src/cosim/fmi/v2/fmu.cpp:

BOOST_LOG_SEV(log::logger(), logLevel)
    << "[FMI status=" << statusName << ", category=" << category << "] "
    << msgBuffer.data();

Giving a null category is perfectly fine, and according to the FMI spec (version 2.0.5, section 2.1.5), it is the default thing to do:

If the FMU does not define any log categories, “category” must be “NULL”.

I haven't checked, but I suspect a similar issue exists for FMI 1.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions