Commit 3bbeb7a3 authored by Guido van Rossum's avatar Guido van Rossum

Fix by Sjoerd: don't want to resize to zero length.

parent 03be7f52
......@@ -1039,8 +1039,13 @@ audioop_ratecv(self, args)
cur_i[chan]));
if (PyErr_Occurred())
return NULL;
if (_PyString_Resize(&str,
ncp - PyString_AsString(str)) < 0)
len = ncp - PyString_AsString(str);
if (len == 0) {
/*don't want to resize to zero length*/
rv = PyString_FromStringAndSize("", 0);
Py_DECREF(str);
str = rv;
} else if (_PyString_Resize(&str, len) < 0)
return NULL;
rv = Py_BuildValue("(O(iO))", str, d, samps);
Py_DECREF(samps);
......
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