Skip to content

Commit 6400ec5

Browse files
Fix endianness in read_single
1 parent a713df6 commit 6400ec5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/_sqlite/blob.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ blob_seterror(pysqlite_Blob *self, int rc)
122122
static PyObject *
123123
read_single(pysqlite_Blob *self, Py_ssize_t offset)
124124
{
125-
unsigned long buf = 0;
125+
unsigned char buf = 0;
126126
int rc;
127127
Py_BEGIN_ALLOW_THREADS
128128
rc = sqlite3_blob_read(self->blob, (void *)&buf, 1, (int)offset);
@@ -132,7 +132,7 @@ read_single(pysqlite_Blob *self, Py_ssize_t offset)
132132
blob_seterror(self, rc);
133133
return NULL;
134134
}
135-
return PyLong_FromUnsignedLong(buf);
135+
return PyLong_FromUnsignedLong((unsigned long)buf);
136136
}
137137

138138
static PyObject *

0 commit comments

Comments
 (0)