diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-06-07 22:27:32 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-06-07 22:27:32 (GMT) |
commit | c971913f849d6c6672821a54a069392a1f7e77f6 (patch) | |
tree | dc12e787f611baf5b66b2c9569486435f1b7fde4 /Objects | |
parent | 990361c0548f446e61e3ecebbcdbf9ab425909de (diff) | |
download | cpython-c971913f849d6c6672821a54a069392a1f7e77f6.zip cpython-c971913f849d6c6672821a54a069392a1f7e77f6.tar.gz cpython-c971913f849d6c6672821a54a069392a1f7e77f6.tar.bz2 |
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
........
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/stringlib/string_format.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h index 42ead89..7043866 100644 --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -327,6 +327,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 ']' */ @@ -380,6 +382,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; /* zero length string is an error */ if (first->ptr >= first->end) { |