Skip to content

[C++] Invalid state management in generated code with precedence checks. #1031

Closed
@szymonwieloch

Description

@szymonwieloch

After enabling precedence checks (sbe.enable.precedence.checks=true) part of the generated code does not work because of mistakes in the internal state management.

For example this will not work:

MessageType msg(buffer, len);
std::cout << msg;

Will throw an exception indicating incorrect use of attributes. What seems to be the root cause of the problem is initialization of the m_codedState variable inside the constructor. Because it is not set explicitly by the constructor(inside the operator << body), it's value becomes:

CodecState m_codecState = CodecState::NOT_WRAPPED;

Which is obviously invalid as the constructor wraps the underlying buffer. It seems that the root cause is not setting the correct value of the m_codecState in the wrapping constructors.

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