Prevent allocating zero bytes.

git-svn-id: svn://10.0.0.236/trunk@141219 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mhammond%skippinet.com.au
2003-04-16 01:23:40 +00:00
parent a3cbf09911
commit ecda3191b7
2 changed files with 4 additions and 0 deletions

View File

@@ -80,6 +80,9 @@ static PyObject *DoPyRead_Size(nsIInputStream *pI, PRUint32 n)
if (NS_FAILED(r))
return PyXPCOM_BuildPyException(r);
}
if (n==0) { // mozilla will assert if we alloc zero bytes.
return PyBuffer_New(0);
}
char *buf = (char *)nsMemory::Alloc(n);
if (buf==NULL) {
PyErr_NoMemory();