Show More
@@ -294,11 +294,21 b' static Py_ssize_t jsonescapelen(const ch' | |||
|
294 | 294 | return -1; |
|
295 | 295 | } |
|
296 | 296 | esclen += jsonparanoidlentable[(unsigned char)c]; |
|
297 | if (esclen < 0) { | |
|
298 | PyErr_SetString(PyExc_MemoryError, | |
|
299 | "overflow in jsonescapelen"); | |
|
300 | return -1; | |
|
301 | } | |
|
297 | 302 | } |
|
298 | 303 | } else { |
|
299 | 304 | for (i = 0; i < len; i++) { |
|
300 | 305 | char c = buf[i]; |
|
301 | 306 | esclen += jsonlentable[(unsigned char)c]; |
|
307 | if (esclen < 0) { | |
|
308 | PyErr_SetString(PyExc_MemoryError, | |
|
309 | "overflow in jsonescapelen"); | |
|
310 | return -1; | |
|
311 | } | |
|
302 | 312 | } |
|
303 | 313 | } |
|
304 | 314 | |
@@ -366,7 +376,7 b' PyObject *jsonescapeu8fast(PyObject *sel' | |||
|
366 | 376 | origlen = PyBytes_GET_SIZE(origstr); |
|
367 | 377 | esclen = jsonescapelen(origbuf, origlen, paranoid); |
|
368 | 378 | if (esclen < 0) |
|
369 | return NULL; /* unsupported char found */ | |
|
379 | return NULL; /* unsupported char found or overflow */ | |
|
370 | 380 | if (origlen == esclen) { |
|
371 | 381 | Py_INCREF(origstr); |
|
372 | 382 | return origstr; |
General Comments 0
You need to be logged in to leave comments.
Login now