incorrect recv in socket.socketpair leads to crashing
In the following code, (a,b) is obtained by socket.socketpair(). 'a' sends a message b'abcdefgh'. Then 'b' executes recv() crashing pypy. This program can work well on macOS and produces a crash on Ubuntu system.
test.py
import socket
(a, b) = socket.socketpair(socket.AF_UNIX, socket.SOCK_DGRAM)
a.send(b'abcdefgh')
result = b.recv(2, socket.MSG_TRUNC)
print(len(result), result)
Error message on Ubuntu
RPython traceback:
File "rpython_rlib_1.c", line 6078, in RSocket_recv
File "rpython_rtyper_lltypesystem.c", line 20109, in str_from_buffer
Fatal RPython error: AssertionError
Aborted (core dumped)
Output on macOS: 2 b'ab'
Environment: pypy3.9-v7.3.10rc3-linux64/bin/pypy3.9 Python 3.9.15 (27701b51ceb0, Nov 23 2022, 18:36:37) [PyPy 7.3.10-candidate3 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)] on linux
lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 18.04.6 LTS Release: 18.04 Codename: bionic