Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer Underflow error while parsing MDI packets in MCX feed #134

Open
AmanBansal619 opened this issue Oct 29, 2024 · 0 comments
Open

Buffer Underflow error while parsing MDI packets in MCX feed #134

AmanBansal619 opened this issue Oct 29, 2024 · 0 comments

Comments

@AmanBansal619
Copy link

mfast_fix/src/mfast/coder/decoder/fast_istreambuf.h(47): Throw in function unsigned char mfast::fast_istreambuf::sbumpc()
Dynamic exception type: boost::exception_detail::clone_implmfast::fast_dynamic_error
std::exception::what: std::exception
[mfast::tag_error_code*] = Buffer underflow

void MdiFoHandler::handleMulticastPacket(const char *buf,
const int32_t incomingLen) {

// DEBUG_LOG("packet length = " << incomingLen);

char *_swapBuffer = new char[incomingLen];

memcpy(_swapBuffer, buf, incomingLen);

try {
    mfast::malloc_allocator malloc_allc;
    mfast::allocator *alloc = &malloc_allc;

    const mfast::templates_description *descriptions[] = {MDIFastTemplates_1_1::description()};
    mfast::fast_decoder decoder(alloc);
    decoder.include(descriptions);

    mfast::message_type msg_value;
    const char *start = buf;

    char *end = const_cast<char *>(buf) + incomingLen;

    bool first_message = false;

    while (start < end) {

// DEBUG_LOG("Decoding MDI message not Skipping n byte header .... -> : " << first_message);
message_cref message = decoder.decode(start, end, first_message);
// DEBUG_LOG("message name = " << message.name() << " : " << " message id = " << message.id());

        first_message = false;
        switch (message.id()) {
            case X: {
                DepthIncremental_cref obj(message);

break;
}
case MESSAGE_TYPE_FAST_RESET: {
first_message = true;
// DEBUG_LOG("Heartbeat/Fast Reset Message Received");
}
break;
}
}
}
catch (boost::exception &e) {
std::cerr << boost::diagnostic_information(e);
return;
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant