diff options
author | Facundo Batista <facundobatista@gmail.com> | 2007-03-28 03:45:20 +0000 |
---|---|---|
committer | Facundo Batista <facundobatista@gmail.com> | 2007-03-28 03:45:20 +0000 |
commit | 1fe9f968a21843175c3cbd6adf632aa95d2f2bef (patch) | |
tree | 85658d73283cf4945e086b3b43224265667908c9 /Lib/test/test_socket.py | |
parent | b20c500251949028d38b32112e864da3cd074be0 (diff) | |
download | cpython-git-1fe9f968a21843175c3cbd6adf632aa95d2f2bef.tar.gz |
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 5be3dc3b5e..24d1a5dd3d 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -597,6 +597,13 @@ class BasicUDPTest(ThreadedUDPSocketTest): def _testRecvFrom(self): self.cli.sendto(MSG, 0, (HOST, PORT)) + def testRecvFromNegative(self): + # Negative lengths passed to recvfrom should give ValueError. + self.assertRaises(ValueError, self.serv.recvfrom, -1) + + def _testRecvFromNegative(self): + self.cli.sendto(MSG, 0, (HOST, PORT)) + class TCPCloserTest(ThreadedTCPSocketTest): def testClose(self): |