Skip to content

Commit 58d3244

Browse files
author
Erlend E. Aasland
committed
Raise OverflowError if size > INT_MAX
1 parent 2241795 commit 58d3244

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/_sqlite/connection.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,9 @@ _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
525525
return -1;
526526
}
527527
if (sz > INT_MAX) {
528-
sz = -1; // Let SQLite compute string length
528+
PyErr_SetString(PyExc_OverflowError,
529+
"String is longer than INT_MAX bytes");
530+
return -1;
529531
}
530532
sqlite3_result_text(context, str, (int)sz, SQLITE_TRANSIENT);
531533
} else if (PyObject_CheckBuffer(py_val)) {

0 commit comments

Comments
 (0)