Comment 1 for bug 1363722

Revision history for this message
Jason Hobbs (jason-hobbs) wrote :

It's failing somewhere in encode_multipart_message() in apiclient/multipart.py

The base64 encoded size of a 1.6GB file will be over 2GB - I wonder if this is what's causing it.

There is some code in cypthon's cStringIO with a matching error and matching size:

static int
IO_cread(PyObject *self, char **output, Py_ssize_t n) {
    Py_ssize_t l;

    if (!IO__opencheck(IOOOBJECT(self))) return -1;
    assert(IOOOBJECT(self)->pos >= 0);
    assert(IOOOBJECT(self)->string_size >= 0);
    l = ((IOobject*)self)->string_size - ((IOobject*)self)->pos;
    if (n < 0 || n > l) {
        n = l;
        if (n < 0) n=0;
    }
    if (n > INT_MAX) {
        PyErr_SetString(PyExc_OverflowError,
                        "length too large");
        return -1;
    }

    *output=((IOobject*)self)->buf + ((IOobject*)self)->pos;
    ((IOobject*)self)->pos += n;
    return (int)n;
}