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 *
139
139
read_multiple (pysqlite_Blob * self , Py_ssize_t length , Py_ssize_t offset )
140
140
{
141
141
assert (length <= sqlite3_blob_bytes (self -> blob ));
142
- assert (offset <= sqlite3_blob_bytes (self -> blob ));
142
+ assert (offset < sqlite3_blob_bytes (self -> blob ));
143
143
144
144
PyObject * buffer = PyBytes_FromStringAndSize (NULL , length );
145
145
if (buffer == NULL ) {
@@ -191,6 +191,11 @@ blob_read_impl(pysqlite_Blob *self, int length)
191
191
length = max_read_len ;
192
192
}
193
193
194
+ assert (length >= 0 );
195
+ if (length == 0 ) {
196
+ return PyBytes_FromStringAndSize (NULL , 0 );
197
+ }
198
+
194
199
PyObject * buffer = read_multiple (self , length , self -> offset );
195
200
if (buffer == NULL ) {
196
201
return NULL ;
You can’t perform that action at this time.
0 commit comments