Thanks to visit codestin.com
Credit goes to github.com

Skip to content

When build with gcc -O2, Socket.ReceiveBufferSize fail.  #20763

@knt09

Description

@knt09

Steps to Reproduce

  1. Build mono in Linux or Android in gcc with -O2
  2. Test -> Socket.ReceiveBufferSize = 50000
  3. try a few more times
  4. You'll see random results

Current Behavior

Roll in 0-65535

Expected Behavior

be correct value

On which platforms did you notice this

[ ] macOS
[x ] Linux and android build by unity
[ ] Windows

Version Used:

all

Stacktrace

int _wapi_setsockopt(guint32 fd, int level, int optname,
const void *optval, socklen_t optlen)
{
....
* int bufsize = *((int *) optval); //is undefined behaviour
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions