summaryrefslogtreecommitdiffstats
path: root/Tools/gdb
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-08 21:07:40 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-08 21:07:40 (GMT)
commitb1856d7fa74e045473a530197a0dedd9052a5e95 (patch)
tree4ef66834d8105e585c690307b8ab32a3f62f0cd7 /Tools/gdb
parentb41e128fe1e2a511748926d0837d1a87f090b9a9 (diff)
downloadcpython-b1856d7fa74e045473a530197a0dedd9052a5e95.zip
cpython-b1856d7fa74e045473a530197a0dedd9052a5e95.tar.gz
cpython-b1856d7fa74e045473a530197a0dedd9052a5e95.tar.bz2
Add a safety limit to the number of unicode characters we fetch
(followup to r84635, suggested by Dave Malcolm).
Diffstat (limited to 'Tools/gdb')
-rw-r--r--Tools/gdb/libpython.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index 79f21e3..361fb03 100644
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -1103,7 +1103,8 @@ class PyUnicodeObjectPtr(PyObjectPtr):
# inferior process: we must join surrogate pairs.
Py_UNICODEs = []
i = 0
- while i < field_length:
+ limit = safety_limit(field_length)
+ while i < limit:
ucs = int(field_str[i])
i += 1
if ucs < 0xD800 or ucs >= 0xDC00 or i == field_length: