diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 18:03:03 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 18:03:03 (GMT) |
commit | 27b74244fbc42f4f50024f14b4b89e6219dedd98 (patch) | |
tree | ebeaa2c81f0be0d7d8258c26d72e77f217602cf6 /Objects | |
parent | dfe2387e7947c65661f152849ea760674a826672 (diff) | |
parent | a83a6a3275f7dc748db3a237bbf4b05fcf76a85f (diff) | |
download | cpython-27b74244fbc42f4f50024f14b4b89e6219dedd98.zip cpython-27b74244fbc42f4f50024f14b4b89e6219dedd98.tar.gz cpython-27b74244fbc42f4f50024f14b4b89e6219dedd98.tar.bz2 |
Issue #28701: _PyUnicode_EqualToASCIIId and _PyUnicode_EqualToASCIIString now
require ASCII right argument and assert this condition in debug build.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 25b3b1d..02f726d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -11062,6 +11062,12 @@ _PyUnicode_EqualToASCIIString(PyObject *unicode, const char *str) { size_t len; assert(_PyUnicode_CHECK(unicode)); + assert(str); +#ifndef NDEBUG + for (const char *p = str; *p; p++) { + assert((unsigned char)*p < 128); + } +#endif if (PyUnicode_READY(unicode) == -1) { /* Memory error or bad data */ PyErr_Clear(); @@ -11082,6 +11088,11 @@ _PyUnicode_EqualToASCIIId(PyObject *left, _Py_Identifier *right) assert(_PyUnicode_CHECK(left)); assert(right->string); +#ifndef NDEBUG + for (const char *p = right->string; *p; p++) { + assert((unsigned char)*p < 128); + } +#endif if (PyUnicode_READY(left) == -1) { /* memory error or bad data */ |