Skip to content

Incorrect return types for recv() and send() on Windows

They return signed 32 bit ints on Windows, even on a 64 bit OS, rather than Linux's 64 bit ssize_t. This means when recv() returned -1 to signal an error we thought it was 4294967295. It was converted to an int, -1 and the buffer was memcpy'd which caused a segfault. Other bad stuff happened with send()s. The problem is in blockingReadRawBufferPtr and blockingWriteRawBufferPtr in GHC.IO.FD which are only called in the threaded RTS.

See also note CSsize in System.Posix.Internals.

I have a patch and a test incoming.

Trac metadata
Trac field Value
Version
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Core Libraries
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ekmett
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information