[Python-checkins] r84636 - python/branches/py3k/Tools/gdb/libpython.py

antoine.pitrou python-checkins at python.org
Wed Sep 8 23:07:40 CEST 2010


Author: antoine.pitrou
Date: Wed Sep  8 23:07:40 2010
New Revision: 84636

Log:
Add a safety limit to the number of unicode characters we fetch
(followup to r84635, suggested by Dave Malcolm).



Modified:
   python/branches/py3k/Tools/gdb/libpython.py

Modified: python/branches/py3k/Tools/gdb/libpython.py
==============================================================================
--- python/branches/py3k/Tools/gdb/libpython.py	(original)
+++ python/branches/py3k/Tools/gdb/libpython.py	Wed Sep  8 23:07:40 2010
@@ -1103,7 +1103,8 @@
             # 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:


More information about the Python-checkins mailing list