Skip to content

Socket::irecv / isend show faulty behavior when bufsize > MAX_INT #5

@blootsvoets

Description

@blootsvoets

The status of C ::send and ::recv is read as an int, but if the buffer size is larger than that, it will deduce there is an error when there is not. In pseudo-code:

char *buf, long long int size;
int status = ::send(buf, size);
if (status < 0)
   report_error();

However, if size is larger than MAX_INT and this is successfully returned by ::send, status will be smaller than zero through casting.

I think its reasonable to assume that the input size should be an int, or that ::send will always return less than MAX_INT, but maybe an explicit comment about these assumptions would be good.

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