summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-09-22 16:14:27 (GMT)
committerGuido van Rossum <guido@python.org>1997-09-22 16:14:27 (GMT)
commit3bbeb7a318d10652f2113d00419cc8f19499b9f0 (patch)
tree52a1d69638bd2681d09a37eacb340e7dc111652e /Modules
parent03be7f525e38306910fc2e5de28ff03cb74bb1b7 (diff)
downloadcpython-3bbeb7a318d10652f2113d00419cc8f19499b9f0.zip
cpython-3bbeb7a318d10652f2113d00419cc8f19499b9f0.tar.gz
cpython-3bbeb7a318d10652f2113d00419cc8f19499b9f0.tar.bz2
Fix by Sjoerd: don't want to resize to zero length.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/audioop.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 471f851..fc33bcd 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -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);