File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ static PyObject *
139139read_multiple (pysqlite_Blob * self , Py_ssize_t length , Py_ssize_t offset )
140140{
141141 assert (length <= sqlite3_blob_bytes (self -> blob ));
142- assert (offset <= sqlite3_blob_bytes (self -> blob ));
142+ assert (offset < sqlite3_blob_bytes (self -> blob ));
143143
144144 PyObject * buffer = PyBytes_FromStringAndSize (NULL , length );
145145 if (buffer == NULL ) {
@@ -191,6 +191,11 @@ blob_read_impl(pysqlite_Blob *self, int length)
191191 length = max_read_len ;
192192 }
193193
194+ assert (length >= 0 );
195+ if (length == 0 ) {
196+ return PyBytes_FromStringAndSize (NULL , 0 );
197+ }
198+
194199 PyObject * buffer = read_multiple (self , length , self -> offset );
195200 if (buffer == NULL ) {
196201 return NULL ;
You can’t perform that action at this time.
0 commit comments