diff options
Diffstat (limited to 'Lib/test/test_poplib.py')
-rw-r--r-- | Lib/test/test_poplib.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index 23d6887..d214375 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -211,6 +211,16 @@ class TestPOP3Class(TestCase): def test_rpop(self): self.assertOK(self.client.rpop('foo')) + def test_apop_REDOS(self): + # Replace welcome with very long evil welcome. + # NB The upper bound on welcome length is currently 2048. + # At this length, evil input makes each apop call take + # on the order of milliseconds instead of microseconds. + evil_welcome = b'+OK' + (b'<' * 1000000) + with test_support.swap_attr(self.client, 'welcome', evil_welcome): + # The evil welcome is invalid, so apop should throw. + self.assertRaises(poplib.error_proto, self.client.apop, 'a', 'kb') + def test_top(self): expected = ('+OK 116 bytes', ['From: postmaster@python.org', 'Content-Type: text/plain', |