Skip to content

Commit 82093fb

Browse files
Address review comments.
1 parent 9e18b74 commit 82093fb

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Lib/plistlib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
# Data larger than this will be read in chunks, to prevent extreme
7777
# overallocation.
78-
_SAFE_BUF_SIZE = 1 << 20
78+
_MIN_READ_BUF_SIZE = 1 << 20
7979

8080
class UID:
8181
def __init__(self, data):
@@ -512,7 +512,7 @@ def _get_size(self, tokenL):
512512
return tokenL
513513

514514
def _read(self, size):
515-
cursize = min(size, _SAFE_BUF_SIZE)
515+
cursize = min(size, _MIN_READ_BUF_SIZE)
516516
data = self._fp.read(cursize)
517517
while True:
518518
if len(data) != cursize:
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
Fix a potential denial of service in the :mod:`plistlib` module.
1+
Fix a potential memory denial of service in the :mod:`plistlib` module.
22
When reading a Plist file received from untrusted source, it could cause
33
an arbitrary amount of memory to be allocated.
4-
In best case this could lead to a :exc:`MemoryError` or other process crash.
5-
In worst case it could lead to swapping which would dramatically slow down the
6-
whole system and make it less responcible.
4+
This could have led to symptoms including a :exc:`MemoryError`, swapping, out
5+
of memory (OOM) killed processes or containers, or even system crashes.

0 commit comments

Comments
 (0)