Show More
@@ -111,7 +111,8 b' b85decode(PyObject *self, PyObject *args' | |||||
111 | if (c < 0) |
|
111 | if (c < 0) | |
112 | return PyErr_Format( |
|
112 | return PyErr_Format( | |
113 | PyExc_ValueError, |
|
113 | PyExc_ValueError, | |
114 |
"bad base85 character at position %d", |
|
114 | "bad base85 character at position %d", | |
|
115 | (int)i); | |||
115 | acc = acc * 85 + c; |
|
116 | acc = acc * 85 + c; | |
116 | } |
|
117 | } | |
117 | if (i++ < len) |
|
118 | if (i++ < len) | |
@@ -120,13 +121,15 b' b85decode(PyObject *self, PyObject *args' | |||||
120 | if (c < 0) |
|
121 | if (c < 0) | |
121 | return PyErr_Format( |
|
122 | return PyErr_Format( | |
122 | PyExc_ValueError, |
|
123 | PyExc_ValueError, | |
123 |
"bad base85 character at position %d", |
|
124 | "bad base85 character at position %d", | |
|
125 | (int)i); | |||
124 | /* overflow detection: 0xffffffff == "|NsC0", |
|
126 | /* overflow detection: 0xffffffff == "|NsC0", | |
125 | * "|NsC" == 0x03030303 */ |
|
127 | * "|NsC" == 0x03030303 */ | |
126 | if (acc > 0x03030303 || (acc *= 85) > 0xffffffff - c) |
|
128 | if (acc > 0x03030303 || (acc *= 85) > 0xffffffff - c) | |
127 | return PyErr_Format( |
|
129 | return PyErr_Format( | |
128 | PyExc_ValueError, |
|
130 | PyExc_ValueError, | |
129 |
"bad base85 sequence at position %d", |
|
131 | "bad base85 sequence at position %d", | |
|
132 | (int)i); | |||
130 | acc += c; |
|
133 | acc += c; | |
131 | } |
|
134 | } | |
132 |
|
135 |
General Comments 0
You need to be logged in to leave comments.
Login now