mFAST icon indicating copy to clipboard operation
mFAST copied to clipboard

Buffer Underflow error while parsing MDI packets in MCX feed

Open AmanBansal619 opened this issue 4 months ago • 0 comments

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

AmanBansal619 avatar Oct 29 '24 13:10 AmanBansal619