diff --git "a/.\\Python-3.5.0rc1/Modules/_io/bytesio.c" "b/.\\Python-3.5.0rc1/Modules/_io/bytesio.c" index d46430d..c1321d5 100644 --- "a/.\\Python-3.5.0rc1/Modules/_io/bytesio.c" +++ "b/.\\Python-3.5.0rc1/Modules/_io/bytesio.c" @@ -46,6 +46,7 @@ typedef struct { #define SHARED_BUF(self) (Py_REFCNT((self)->buf) > 1) +#define GET_BYTES_SIZE(self) ((size_t)PyBytes_GET_SIZE((self)->buf)) /* Internal routine to get a line from the buffer of a BytesIO object. Returns the length between the current position to the @@ -58,6 +59,9 @@ scan_eol(bytesio *self, Py_ssize_t len) assert(self->buf != NULL); + if (self->pos >= GET_BYTES_SIZE(self)) + return 0; + /* Move to the end of the line, up to the end of the string, s. */ start = PyBytes_AS_STRING(self->buf) + self->pos; maxlen = self->string_size - self->pos;