]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-74573: document that ndbm can silently corrupt databases on macOS (#113354)
authorRonald Oussoren <ronaldoussoren@mac.com>
Sat, 23 Dec 2023 12:33:34 +0000 (13:33 +0100)
committerGitHub <noreply@github.com>
Sat, 23 Dec 2023 12:33:34 +0000 (13:33 +0100)
* 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.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Doc/library/dbm.rst
Doc/library/shelve.rst
Misc/NEWS.d/next/macOS/2023-12-21-11-53-47.gh-issue-74573.MA6Vys.rst [new file with mode: 0644]

index 766847b971b645af3a1da6b85d5083fbe76931c0..cb95c61322582f6affad31f512e77c20f8ba6dd1 100644 (file)
@@ -272,6 +272,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
index 88802d717d738387407b6ba3956d973523368582..95c549918870221fd0946fcd289dd517b29b435f 100644 (file)
@@ -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 (file)
index 0000000..96dcd47
--- /dev/null
@@ -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)