diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-15 22:32:41 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-15 22:32:41 (GMT) |
commit | 23edd49e5bb05d8999d5a181d17d3f4226243ac1 (patch) | |
tree | ad769c84f68261ed5b76fb0bd166d8274b097dde /Lib/test/test_dbm_dumb.py | |
parent | c481bfb3f62787e9ef0947785df7383a173a23c3 (diff) | |
parent | 74eb8b2d1a1db905cffc4efcd1cefaf1f725cd81 (diff) | |
download | cpython-23edd49e5bb05d8999d5a181d17d3f4226243ac1.zip cpython-23edd49e5bb05d8999d5a181d17d3f4226243ac1.tar.gz cpython-23edd49e5bb05d8999d5a181d17d3f4226243ac1.tar.bz2 |
Issue #22885: Fixed arbitrary code execution vulnerability in the dbm.dumb
module. Original patch by Claudiu Popa.
Diffstat (limited to 'Lib/test/test_dbm_dumb.py')
-rw-r--r-- | Lib/test/test_dbm_dumb.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py index ee5a32f..ff63c88 100644 --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -225,6 +225,15 @@ class DumbDBMTestCase(unittest.TestCase): with dumbdbm.open(_fname, 'n') as f: self.assertEqual(f.keys(), []) + def test_eval(self): + with open(_fname + '.dir', 'w') as stream: + stream.write("str(print('Hacked!')), 0\n") + with support.captured_stdout() as stdout: + with self.assertRaises(ValueError): + with dumbdbm.open(_fname) as f: + pass + self.assertEqual(stdout.getvalue(), '') + def tearDown(self): _delete_files() |