Kaydet (Commit) b1856d7f authored tarafından Antoine Pitrou's avatar Antoine Pitrou

Add a safety limit to the number of unicode characters we fetch

(followup to r84635, suggested by Dave Malcolm).
üst b41e128f
...@@ -1103,7 +1103,8 @@ class PyUnicodeObjectPtr(PyObjectPtr): ...@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment