cellml / libcellml

Repository for libCellML development.
https://libcellml.org
Apache License 2.0
17 stars 21 forks source link

SegFault during model flattening #1302

Closed agarny closed 6 days ago

agarny commented 1 week ago

To try to flatten experiments/periodic-stimulus.xml in Archive.zip results in a SegFault:

TEST(Experiment, experiment)
{
    auto parser = libcellml::Parser::create(false);
    auto model = parser->parseModel(fileContents("importer/experiment/experiments/periodic-stimulus.xml"));

    EXPECT_EQ(size_t(0), parser->errorCount());

    auto validator = libcellml::Validator::create();

    validator->validateModel(model);

    EXPECT_EQ(size_t(0), validator->issueCount());
    EXPECT_TRUE(model->hasUnresolvedImports());

    auto importer = libcellml::Importer::create(false);

    importer->resolveImports(model, resourcePath("importer/experiment/experiments"));

    EXPECT_FALSE(model->hasUnresolvedImports());

    auto flattenModel = importer->flattenModel(model);

    EXPECT_NE(nullptr, flattenModel);
}