projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6b78bff
)
Issue #15989: Fix possible integer overflow in str formatting as in unicode formatting.
author
Serhiy Storchaka
<storchaka@gmail.com>
Sat, 19 Jan 2013 21:35:46 +0000
(23:35 +0200)
committer
Serhiy Storchaka
<storchaka@gmail.com>
Sat, 19 Jan 2013 21:35:46 +0000
(23:35 +0200)
Objects/stringobject.c
patch
|
blob
|
history
diff --git
a/Objects/stringobject.c
b/Objects/stringobject.c
index c6f2220bbf6697d4af5c0740a69ab3f3914a829b..b9809a276bd6f3fc19aafde4f758ff0992ea8af7 100644
(file)
--- a/
Objects/stringobject.c
+++ b/
Objects/stringobject.c
@@
-4355,7
+4355,9
@@
PyString_Format(PyObject *format, PyObject *args)
"* wants int");
goto error;
}
- width = PyInt_AsLong(v);
+ width = PyInt_AsSsize_t(v);
+ if (width == -1 && PyErr_Occurred())
+ goto error;
if (width < 0) {
flags |= F_LJUST;
width = -width;
@@
-4392,7
+4394,9
@@
PyString_Format(PyObject *format, PyObject *args)
"* wants int");
goto error;
}
- prec = PyInt_AsLong(v);
+ prec = _PyInt_AsInt(v);
+ if (prec == -1 && PyErr_Occurred())
+ goto error;
if (prec < 0)
prec = 0;
if (--fmtcnt >= 0)