Commit c10c557b authored by Stefan Behnel's avatar Stefan Behnel

fix ASCII compatibility check in __Pyx_init_sys_getdefaultencoding_params():...

fix ASCII compatibility check in __Pyx_init_sys_getdefaultencoding_params(): strncmp() stops at first NUL byte which is the first byte in this case (i.e. no comparison is done at all)

--HG--
extra : transplant_source : A%2B%5BO%82%05%F7%DEm/%8Ao%08%121%96%8Ao%AB%8C
parent 42a20907
......@@ -95,7 +95,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) {
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
if (!ascii_chars_u) goto bad;
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
PyErr_Format(
PyExc_ValueError,
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment