projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4b2f9e9
)
Fix out of bounds read in long_new() for empty bytes with an explicit base. int(b...
author
Christian Heimes
<christian@cheimes.de>
Wed, 12 Sep 2012 13:31:43 +0000
(15:31 +0200)
committer
Christian Heimes
<christian@cheimes.de>
Wed, 12 Sep 2012 13:31:43 +0000
(15:31 +0200)
Objects/longobject.c
patch
|
blob
|
history
diff --git
a/Objects/longobject.c
b/Objects/longobject.c
index a735e33e0463bf2aa601bd71d29ae6b5212b9dad..f2f63afbf69989bfb57dc17b1da5d1459720da6f 100644
(file)
--- a/
Objects/longobject.c
+++ b/
Objects/longobject.c
@@
-4149,8
+4149,8
@@
long_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
string = PyByteArray_AS_STRING(x);
else
string = PyBytes_AS_STRING(x);
- if (strlen(string) != (size_t)size) {
- /* We only see this if there's a null byte in x,
+ if (strlen(string) != (size_t)size
|| !size
) {
+ /* We only see this if there's a null byte in x
or x is empty
,
x is a bytes or buffer, *and* a base is given. */
PyErr_Format(PyExc_ValueError,
"invalid literal for int() with base %d: %R",