Skip to content

DGeometry::GetCompositeMaterial seems incomplete #1079

@jase231

Description

@jase231

I am working my way through some of the bugs found by clang's static analyzer. #1067
In DGeometry.cc, it seems to have found a path leaving values uninitialized due to an incomplete GetCompositeMaterial function.

According to a comment on line 580, GetMaterials() calls GetCompositeMaterial() when querying the composite tag fails. However, GetCompositeMaterial() seems to be a stub. It takes density and radlen as references but never assigns to them. It extracts component name and mass fraction, logs them to debug, and quits. Theoretically that could leave those variables uninitialized when they are passed to the DMaterial ctor on line 588.

Since this code hasn't been touched in 15 years, I would presume that querying the composite tag never fails, since this would've probably reared its head by now.

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