Skip to content

Uninitialized jump in render's Transformation2D::readAttributes #398

@luciansmith

Description

@luciansmith

Running stuff through valgrind, I came across the error:

==4973== Conditional jump or move depends on uninitialised value(s)
==4973==    at 0xD75631: libsbml::Transformation2D::readAttributes(libsbml::XMLAttributes const&, libsbml::ExpectedAttributes const&) (Transformation2D.cpp:725)
==4973==    by 0xD2454F: libsbml::GraphicalPrimitive1D::readAttributes(libsbml::XMLAttributes const&, libsbml::ExpectedAttributes const&) (GraphicalPrimitive1D.cpp:1123)
==4973==    by 0xD2879D: libsbml::GraphicalPrimitive2D::readAttributes(libsbml::XMLAttributes const&, libsbml::ExpectedAttributes const&) (GraphicalPrimitive2D.cpp:858)
==4973==    by 0xD5DCB3: libsbml::RenderGroup::readAttributes(libsbml::XMLAttributes const&, libsbml::ExpectedAttributes const&) (RenderGroup.cpp:2253)
==4973==    by 0xB646A3: libsbml::SBase::read(libsbml::XMLInputStream&) (SBase.cpp:4467)
==4973==    by 0xB65013: libsbml::SBase::read(libsbml::XMLInputStream&) (SBase.cpp:4606)
==4973==    by 0xB65013: libsbml::SBase::read(libsbml::XMLInputStream&) (SBase.cpp:4606)
==4973==    by 0xB65013: libsbml::SBase::read(libsbml::XMLInputStream&) (SBase.cpp:4606)
==4973==    by 0xB65013: libsbml::SBase::read(libsbml::XMLInputStream&) (SBase.cpp:4606)
==4973==    by 0xB65013: libsbml::SBase::read(libsbml::XMLInputStream&) (SBase.cpp:4606)
==4973==    by 0xB65013: libsbml::SBase::read(libsbml::XMLInputStream&) (SBase.cpp:4606)
==4973==    by 0xB65013: libsbml::SBase::read(libsbml::XMLInputStream&) (SBase.cpp:4606)

Investigating, my guess is that this is because the parent of the Transformation2D is always cast to a 'ListOfDrawables', which it absolutely does not have to be: there are several different types of objects that Transformation2D objects can be the children of. In one file I read, here are all the different types:

  • ListOfLineEndings, which claims to be the type SBML_LIST_OF
  • LineEnding (SBML_RENDER_LINEENDING) (doesn't inherit from ListOf)
  • RenderGroup (SBML_RENDER_GROUP) (also not a ListOf)
  • GlobalStyle (SBML_RENDER_GLOBALSTYLE) (also not a ListOf, nor does it inherit from the LineEnding/RenderGroup base classes)

None of those are ListOfDrawables!

The code seems to want to change 'UnknownPackageAttribute' and 'UnknownCoreAttribute' errors to Render-specific errors. Do we need to do this for all the different Things That The Parent Might Be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions