Merged revisions 74169 via svnmerge from

svn+ssh://svn.python.org/python/branches/py3k

................
  r74169 | georg.brandl | 2009-07-22 14:03:59 +0200 (Mi, 22 Jul 2009) | 9 lines

  Merged revisions 74167 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r74167 | georg.brandl | 2009-07-22 13:57:15 +0200 (Mi, 22 Jul 2009) | 1 line

    Issue #6540: Fixed crash for bytearray.translate() with invalid parameters.
  ........
................
This commit is contained in:
Georg Brandl 2009-07-22 12:06:11 +00:00
parent 3cc12f6942
commit 069bcc3dd9
3 changed files with 12 additions and 3 deletions

View file

@ -1389,15 +1389,17 @@ bytearray_translate(PyByteArrayObject *self, PyObject *args)
if (vtable.len != 256) {
PyErr_SetString(PyExc_ValueError,
"translation table must be 256 characters long");
goto done;
PyBuffer_Release(&vtable);
return NULL;
}
table = (const char*)vtable.buf;
}
if (delobj != NULL) {
if (_getbuffer(delobj, &vdel) < 0) {
delobj = NULL; /* don't try to release vdel buffer on exit */
goto done;
if (tableobj != NULL)
PyBuffer_Release(&vtable);
return NULL;
}
}
else {