diff Tools/gdb/libpython.py @ 64571:b1cf3f7f304c

Add a safety limit to the number of unicode characters we fetch (followup to r84635, suggested by Dave Malcolm).
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 08 Sep 2010 21:07:40 +0000
parents a2aeddc19b66
children 441e94ce4087
line wrap: on
line diff
--- a/Tools/gdb/libpython.py	Wed Sep 08 20:57:48 2010 +0000
+++ b/Tools/gdb/libpython.py	Wed Sep 08 21:07:40 2010 +0000
@@ -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: