mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Add a safety limit to the number of unicode characters we fetch
(followup to r84635, suggested by Dave Malcolm).
This commit is contained in:
parent
b41e128fe1
commit
b1856d7fa7
1 changed files with 2 additions and 1 deletions
|
@ -1103,7 +1103,8 @@ class PyUnicodeObjectPtr(PyObjectPtr):
|
||||||
# inferior process: we must join surrogate pairs.
|
# inferior process: we must join surrogate pairs.
|
||||||
Py_UNICODEs = []
|
Py_UNICODEs = []
|
||||||
i = 0
|
i = 0
|
||||||
while i < field_length:
|
limit = safety_limit(field_length)
|
||||||
|
while i < limit:
|
||||||
ucs = int(field_str[i])
|
ucs = int(field_str[i])
|
||||||
i += 1
|
i += 1
|
||||||
if ucs < 0xD800 or ucs >= 0xDC00 or i == field_length:
|
if ucs < 0xD800 or ucs >= 0xDC00 or i == field_length:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue