Commit ee7c8f9a authored by Neal Norwitz's avatar Neal Norwitz

It's very unlikely, though possible that source is not a string. Verify

that PyString_AsString() returns a valid pointer.  (The problem can
arise when zlib.decompress doesn't return a string.)

Klocwork 346
parent 5aa96895
......@@ -950,6 +950,9 @@ normalize_line_endings(PyObject *source)
char *buf, *q, *p = PyString_AsString(source);
PyObject *fixed_source;
if (!p)
return NULL;
/* one char extra for trailing \n and one for terminating \0 */
buf = (char *)PyMem_Malloc(PyString_Size(source) + 2);
if (buf == NULL) {
......
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