Skip to content

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

Open
@AmanBansal619

Description

@AmanBansal619

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;
}
}

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