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

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

Open
luciansmith opened this issue Sep 11, 2024 · 1 comment
Open

Comments

@luciansmith
Copy link
Member

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?

luciansmith added a commit that referenced this issue Sep 14, 2024
First pass at a fix for #398, which resulted from inappropriately casting an element.  Not sure I got all the use cases, but I might have?
@luciansmith
Copy link
Member Author

luciansmith commented Sep 14, 2024

See b22583e for an attempt to fix this. Mostly I'm not entirely sure what situation causes the errors to show up in the log like that, when they need to be moved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant