mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
PyUnicode_EncodeUTF8: squash compiler wng. The difference of two
pointers is a signed type. Changing "allocated" to a signed int makes undetected overflow more likely, but there was no overflow detection before either.
This commit is contained in:
parent
dc374e034a
commit
7e3d961fc1
1 changed files with 5 additions and 4 deletions
|
@ -1172,13 +1172,14 @@ int utf8_encoding_error(const Py_UNICODE **source,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s,
|
PyObject *
|
||||||
int size,
|
PyUnicode_EncodeUTF8(const Py_UNICODE *s,
|
||||||
const char *errors)
|
int size,
|
||||||
|
const char *errors)
|
||||||
{
|
{
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
char *p;
|
char *p;
|
||||||
unsigned int allocated = 0;
|
int allocated = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Short-cut for emtpy strings */
|
/* Short-cut for emtpy strings */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue