Skip to content

An error from read in FrameReceiverTCPRxThread can cause integer underflow in number of bytes received #387

@BenBradnick

Description

@BenBradnick

An error return value of read is not currently handled by FrameReceiverTCPRxThread::handle_receive_socket. A return value of -1 to indicate an error can currently result in the number of bytes received to be 2**64 -1 due to underflow:

  size_t bytes_received = 0;

  while (bytes_received < message_size) {
    int msg_len =
        read(recv_socket_, frame_buffer, message_size - bytes_received);
    bytes_received += msg_len;
    frame_buffer += msg_len;
  }

This then tells the decoder that there are 18446744073709551615 bytes to process.

Metadata

Metadata

Assignees

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