We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7a00c2 commit a713df6Copy full SHA for a713df6
1 file changed
Modules/_sqlite/blob.c
@@ -139,7 +139,7 @@ static PyObject *
139
read_multiple(pysqlite_Blob *self, Py_ssize_t length, Py_ssize_t offset)
140
{
141
assert(length <= sqlite3_blob_bytes(self->blob));
142
- assert(offset <= sqlite3_blob_bytes(self->blob));
+ assert(offset < sqlite3_blob_bytes(self->blob));
143
144
PyObject *buffer = PyBytes_FromStringAndSize(NULL, length);
145
if (buffer == NULL) {
@@ -191,6 +191,11 @@ blob_read_impl(pysqlite_Blob *self, int length)
191
length = max_read_len;
192
}
193
194
+ assert(length >= 0);
195
+ if (length == 0) {
196
+ return PyBytes_FromStringAndSize(NULL, 0);
197
+ }
198
+
199
PyObject *buffer = read_multiple(self, length, self->offset);
200
201
return NULL;
0 commit comments