Skip to content

concore.hpp and [concoredocker.hpp] are copy-pastes with a broken include guard and unsafe parser #456

@avinxshKD

Description

@avinxshKD

concoredocker.hpp is a copy-paste of concore.hpp with the Docker paths. They've drifted apart and have two real bugs

bug 1: (Duplicate include guard)
Both files use #ifndef CONCORE_HPP. If any C++ project includes both headers, the preprocessor silently drops the second one. The docker Concore class vanishes with no error. concoredocker.hpp should use CONCOREDOCKER_HPP.

bug2: (mapParser() in concore.hpp has no bounds check)

while(portstr[i]!='}'){
    while(portstr[i]!='\''){   //  no bounds check on i
        portname+=portstr[i];
        i++;
    }

A malformed or partially written concore.iport file (missing closing quote or brace) sends i past the string length, undefined behavior, likely SIGSEGV. concoredocker.hpp uses a safe stringstream-based parser that doesn't have this problem.

Fix is to pull shared utilities (stripstr, stripquotes, parsedict, parselist, load_params, default_maxtime, tryparam) into a concore_base.hpp, same pattern as the concore_base.py dedup in PR #442

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