diff options
| author | Benjamin Peterson <benjamin@python.org> | 2010-06-07 22:23:23 +0000 |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2010-06-07 22:23:23 +0000 |
| commit | 0c83929eb489d8562f6a8533b58cac8ccc0663b0 (patch) | |
| tree | f0b383ab27652428ec3d56a1a64744154a9cb671 /Objects | |
| parent | 32a33a9f0e1c53dca684e0895596af85bb803e5c (diff) | |
| download | cpython-0c83929eb489d8562f6a8533b58cac8ccc0663b0.tar.gz | |
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 0aafb14286..e7bf724b39 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; |
