Skip to content

Variable length encoding fails the simpler test #40

Description

@lrodorigo

The source code is quite self-explaining.
The code is properly working if the fixed-length econding is enable.
Linux - GCC v 14.1.1 - Current master branch.
Really scaring.

#include "alpaca/alpaca.h"

struct Simple {
    uint32_t field {0};
};

int main() {
    Simple data {0x12345678};

    std::vector<uint8_t> bytes;
    auto size = alpaca::serialize(data, bytes);

    std::error_code err;
    auto reconstructed = alpaca::deserialize<Simple>(bytes, err);

    assert(!err);
    
    assert(reconstructed.field == data.field); // And here it dies.
}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions