summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-12-23 12:49:33 (GMT)
committerGitHub <noreply@github.com>2023-12-23 12:49:33 (GMT)
commit4882d508be46eff5ae2d55d82f0aab169a59a0ed (patch)
treed1d80ecb08a3bc41945b534375ce041eeaecb808
parentfc4d2c3dc66d34eddadd1208984a38a46757d6da (diff)
downloadcpython-4882d508be46eff5ae2d55d82f0aab169a59a0ed.zip
cpython-4882d508be46eff5ae2d55d82f0aab169a59a0ed.tar.gz
cpython-4882d508be46eff5ae2d55d82f0aab169a59a0ed.tar.bz2
[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 593b4d81d276b428f926debfe70d56ba94edf0e1) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
-rw-r--r--Doc/library/dbm.rst7
-rw-r--r--Doc/library/shelve.rst3
-rw-r--r--Misc/NEWS.d/next/macOS/2023-12-21-11-53-47.gh-issue-74573.MA6Vys.rst3
3 files changed, 13 insertions, 0 deletions
diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst
index 2be4993..8b799ad 100644
--- a/Doc/library/dbm.rst
+++ b/Doc/library/dbm.rst
@@ -265,6 +265,13 @@ This module can be used with the "classic" ndbm interface or the GNU GDBM
compatibility interface. On Unix, the :program:`configure` script will attempt
to locate the appropriate header file to simplify building this module.
+.. warning::
+
+ The ndbm library shipped as part of macOS has an undocumented limitation on the
+ size of values, which can result in corrupted database files
+ when storing values larger than this limit. Reading such corrupted files can
+ result in a hard crash (segmentation fault).
+
.. exception:: error
Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:`KeyError` is raised
diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst
index 88802d7..95c5499 100644
--- a/Doc/library/shelve.rst
+++ b/Doc/library/shelve.rst
@@ -113,6 +113,9 @@ Restrictions
differs across Unix versions and requires knowledge about the database
implementation used.
+* On macOS :mod:`dbm.ndbm` can silently corrupt the database file on updates,
+ which can cause hard crashes when trying to read from the database.
+
.. class:: Shelf(dict, protocol=None, writeback=False, keyencoding='utf-8')
diff --git a/Misc/NEWS.d/next/macOS/2023-12-21-11-53-47.gh-issue-74573.MA6Vys.rst b/Misc/NEWS.d/next/macOS/2023-12-21-11-53-47.gh-issue-74573.MA6Vys.rst
new file mode 100644
index 0000000..96dcd47
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2023-12-21-11-53-47.gh-issue-74573.MA6Vys.rst
@@ -0,0 +1,3 @@
+Document that :mod:`dbm.ndbm` can silently corrupt DBM files on updates when
+exceeding undocumented platform limits, and can crash (segmentation fault)
+when reading such a corrupted file. (FB8919203)