]> granicus.if.org Git - python/commitdiff
Add a safety limit to the number of unicode characters we fetch
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 8 Sep 2010 21:07:40 +0000 (21:07 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 8 Sep 2010 21:07:40 +0000 (21:07 +0000)
(followup to r84635, suggested by Dave Malcolm).

Tools/gdb/libpython.py

index 79f21e3f86ab26aa640e04872797d64e75bb1c92..361fb033037fd50e63332d31ecd99035a53a07f4 100644 (file)
@@ -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: