Skip to content

Uninitialized memory in int/channel/dom.hpp #128

Description

@mattiasgronkvist

Describe the bug

When running our test suite using the valgrind/memcheck tool, we discovered that the assigned variable on line 256 in gecode/int/channel/dom.hpp can end up uninitialized. This is a problem as it is used in an if statement on line 258, triggering a 'Conditional jump or move depends on uninitialised value(s)' warning in memcheck.

Clearly, the code expects that the distinct propagate() call on line 257 will set the assigned variable, but it is pretty straightforward to see that the assigned reference parameter is not always assigned a value in propagate().

I don't know how serious this issue is, but we have not observed any actual bad behavior except for the memcheck warning. It also seems clear that the distinct propagator is called with an uninitialized assigned variable in a few other cases in the code.

To Reproduce

I don't know of a simple way to reproduce the problem outside of our internal test case, but it should be fairly straightforward to manually find the issue from the description above.

Gecode and Platform Configuration

Gecode 6.2.0
Red Hat Enterprise Linux 7
g++ (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
Valgrind-3.15.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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