module. Original patch by Claudiu Popa.
"""
+import ast as _ast
import os as _os
import __builtin__
import UserDict
with f:
for line in f:
line = line.rstrip()
- key, pos_and_siz_pair = eval(line)
+ key, pos_and_siz_pair = _ast.literal_eval(line)
self._index[key] = pos_and_siz_pair
# Write the index dict to the directory file. The original directory
self.assertEqual(expected, got)
f.close()
+ def test_eval(self):
+ with open(_fname + '.dir', 'w') as stream:
+ stream.write("str(__import__('sys').stdout.write('Hacked!')), 0\n")
+ with test_support.captured_stdout() as stdout:
+ with self.assertRaises(ValueError):
+ dumbdbm.open(_fname).close()
+ self.assertEqual(stdout.getvalue(), '')
+
def tearDown(self):
_delete_files()
Library
-------
+- Issue #22885: Fixed arbitrary code execution vulnerability in the dumbdbm
+ module. Original patch by Claudiu Popa.
+
- Issue #21849: Fixed xmlrpclib serialization of non-ASCII unicode strings in
the multiprocessing module.