From 59a1b2f732e9c672ec03deb965bd682706d1ef24 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Mon, 7 Jun 2010 22:31:26 +0000 Subject: Merged revisions 81820 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81820 | benjamin.peterson | 2010-06-07 17:23:23 -0500 (Mon, 07 Jun 2010) | 1 line correctly overflow when indexes are too large ........ --- Objects/stringlib/string_format.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Objects/stringlib/string_format.h') diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h index ecb00a9a1e..bc70e97be4 100644 --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -373,6 +373,8 @@ FieldNameIterator_next(FieldNameIterator *self, int *is_attribute, if (_FieldNameIterator_item(self, name) == 0) return 0; *name_idx = get_integer(name); + if (*name_idx == -1 && PyErr_Occurred()) + return 0; break; default: /* Invalid character follows ']' */ @@ -429,6 +431,8 @@ field_name_split(STRINGLIB_CHAR *ptr, Py_ssize_t len, SubString *first, /* see if "first" is an integer, in which case it's used as an index */ *first_idx = get_integer(first); + if (*first_idx == -1 && PyErr_Occurred()) + return 0; field_name_is_empty = first->ptr >= first->end; -- cgit v1.2.1