From 2af23f777eefeadbb1cc3c6317d074285372afe4 Mon Sep 17 00:00:00 2001 From: dxbjavid Date: Wed, 3 Jun 2026 14:33:41 +0530 Subject: [PATCH] guard oversized string length in ResultText --- sqlite3_context.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sqlite3_context.go b/sqlite3_context.go index 37fcb56..4436279 100644 --- a/sqlite3_context.go +++ b/sqlite3_context.go @@ -90,6 +90,10 @@ func (c *SQLiteContext) ResultNull() { // ResultText sets the result of an SQL function. // See: sqlite3_result_text, http://sqlite.org/c3ref/result_blob.html func (c *SQLiteContext) ResultText(s string) { + if i64 && len(s) > math.MaxInt32 { + C.sqlite3_result_error_toobig((*C.sqlite3_context)(c)) + return + } if len(s) == 0 { C.my_result_text((*C.sqlite3_context)(c), (*C.char)(unsafe.Pointer(&placeHolder[0])), 0) return