From d409970d551d4cc9c8fc969cb3f39b0a2334841f Mon Sep 17 00:00:00 2001
From: zwtmichael <zhuwentao5@huawei.com>
Date: Tue, 6 Sep 2022 10:47:19 +0800
Subject: [PATCH] fix integer overflow on gigabyte string

Signed-off-by: zwtmichael <zhuwentao5@huawei.com>
---
 src/printf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/printf.c b/src/printf.c
index ae95702..699bdb5 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -798,8 +798,8 @@ void sqlite3_str_vappendf(
       case etSQLESCAPE:           /* %q: Escape ' characters */
       case etSQLESCAPE2:          /* %Q: Escape ' and enclose in '...' */
       case etSQLESCAPE3: {        /* %w: Escape " characters */
-        int i, j, k, n, isnull;
-        int needQuote;
+        i64 i, j, k, n;
+        int needQuote, isnull;
         char ch;
         char q = ((xtype==etSQLESCAPE3)?'"':'\'');   /* Quote character */
         char *escarg;
-- 
2.25.1

