prost-planner / prost

probabilistic planning system for tasks encoded in RDDL
MIT License
37 stars 17 forks source link

seg-fault in domains with enum types #132

Closed geisserf closed 3 years ago

geisserf commented 3 years ago

Reported by Mostafa, Hala via mail:

  1. In domains with enumerated types (like the chromatic dice domain), the code gives segmentation fault due to the following section in prost_planner.cc void ProstPlanner::initSession(int _numberOfRounds, long /totalTime/) { Logger::logSeparator(Verbosity::VERBOSE); Logger::logLine("Final task: ", Verbosity::VERBOSE); SearchEngine::printTask();

The method SearchEngine::printTask() seems to expect binary values, I think. Anyway, commenting it out was the solution for me.

This bug was introduced in 3f754f8.

geisserf commented 3 years ago

The issue is the code that was added to EqualsExpression::print:

    if ((exprs.size() == 2)) {
        ActionFluent* af = static_cast<ActionFluent*>(exprs[0]);
        NumericConstant* val = static_cast<NumericConstant*>(exprs[1]);
        if (af && val) {
            out << af->values[val->value];
            return;
        }
    }

This must of course be a dynamic_cast instead of a static_cast.

thomaskeller79 commented 3 years ago

Resolved in commit 7f4f30801896ce5819f2f727561262e2213beaf5

Hala, thanks for reporting this and @geisserf, thanks for fixing this!