Skip to content

Commit 4882d50

Browse files
miss-islingtonronaldoussorenerlend-aasland
authored
[3.12] gh-74573: document that ndbm can silently corrupt databases on macOS (GH-113354) (#113431)
gh-74573: document that ndbm can silently corrupt databases on macOS (GH-113354) * gh-74573: document that ndbm can silently corrupt databases on macOS The system ndbm implementation on macOS has an undocumented limitation on the size of values and can silently corrupt database files when those are exceeded. (cherry picked from commit 593b4d8) Co-authored-by: Ronald Oussoren <[email protected]> Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent fc4d2c3 commit 4882d50

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Doc/library/dbm.rst

+7
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,13 @@ This module can be used with the "classic" ndbm interface or the GNU GDBM
265265
compatibility interface. On Unix, the :program:`configure` script will attempt
266266
to locate the appropriate header file to simplify building this module.
267267

268+
.. warning::
269+
270+
The ndbm library shipped as part of macOS has an undocumented limitation on the
271+
size of values, which can result in corrupted database files
272+
when storing values larger than this limit. Reading such corrupted files can
273+
result in a hard crash (segmentation fault).
274+
268275
.. exception:: error
269276

270277
Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:`KeyError` is raised

Doc/library/shelve.rst

+3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ Restrictions
113113
differs across Unix versions and requires knowledge about the database
114114
implementation used.
115115

116+
* On macOS :mod:`dbm.ndbm` can silently corrupt the database file on updates,
117+
which can cause hard crashes when trying to read from the database.
118+
116119

117120
.. class:: Shelf(dict, protocol=None, writeback=False, keyencoding='utf-8')
118121

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Document that :mod:`dbm.ndbm` can silently corrupt DBM files on updates when
2+
exceeding undocumented platform limits, and can crash (segmentation fault)
3+
when reading such a corrupted file. (FB8919203)

0 commit comments

Comments
 (0)