Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check the size of serialized data
  • Loading branch information
neonene authored May 24, 2022
commit 3fbf0d02bf85ed5221c756dc5c10886c4d51faa6
7 changes: 7 additions & 0 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -2091,6 +2091,13 @@ serialize_impl(pysqlite_Connection *self, const char *name)
name);
return NULL;
}
#if PY_SSIZE_T_MAX < 9223372036854775807
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
if (size > PY_SSIZE_T_MAX) {
Comment thread
neonene marked this conversation as resolved.
Outdated
PyErr_Format(PyExc_OverflowError,
"serialized '%s' too large to convert to bytes", name);
return NULL;
}
#endif
PyObject *res = PyBytes_FromStringAndSize(data, (Py_ssize_t)size);
if (!(flags & SQLITE_SERIALIZE_NOCOPY)) {
sqlite3_free((void *)data);
Expand Down