Commit 827278c4 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)
parent 147938bb
...@@ -95,7 +95,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { ...@@ -95,7 +95,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) {
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
if (!ascii_chars_u) goto bad; if (!ascii_chars_u) goto bad;
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); 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( PyErr_Format(
PyExc_ValueError, PyExc_ValueError,
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", "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