summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 8b54643..cee78a0 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -3313,7 +3313,8 @@ string_expandtabs(PyStringObject *self, PyObject *args)
if (tabsize > 0) {
j += tabsize - (j % tabsize);
if (old_j > j) {
- PyErr_SetString(PyExc_OverflowError, "new string is too long");
+ PyErr_SetString(PyExc_OverflowError,
+ "new string is too long");
return NULL;
}
old_j = j;
@@ -3323,7 +3324,12 @@ string_expandtabs(PyStringObject *self, PyObject *args)
j++;
if (*p == '\n' || *p == '\r') {
i += j;
- j = 0;
+ old_j = j = 0;
+ if (i < 0) {
+ PyErr_SetString(PyExc_OverflowError,
+ "new string is too long");
+ return NULL;
+ }
}
}