From 5a05c59d4d75c03f23d5fb70feac9f789954bf8a Mon Sep 17 00:00:00 2001
From: drh <>
Date: Sat, 6 Dec 2025 20:41:24 +0000
Subject: [PATCH] In the zipfile extension, only return as many bytes as
 Inflate actually generated.  [forum:/forumpost/761eac3c82|Forum post
 761eac3c82]. Adjust ./configure so that it builds zipfile into testfixture if
 ZLIB is available, so that tests get run on unix platforms.

FossilOrigin-Name: 3d459f1fb1bd1b5e723629c463ab392af7b206ece3388bda216c6a4c26160909

Upstream-Status: Backport [https://github.com/sqlite/sqlite/commit/5a05c59d4d75c03f23d5fb70feac9f789954bf8a]
CVE: CVE-2025-70873
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
 shell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shell.c b/shell.c
index fa45d40..3c4902c 100644
--- a/shell.c
+++ b/shell.c
@@ -7668,7 +7668,7 @@ static void zipfileInflate(
       if( err!=Z_STREAM_END ){
         zipfileCtxErrorMsg(pCtx, "inflate() failed (%d)", err);
       }else{
-        sqlite3_result_blob(pCtx, aRes, nOut, zipfileFree);
+        sqlite3_result_blob(pCtx, aRes, (int)str.total_out, zipfileFree);
         aRes = 0;
       }
     }
-- 
2.25.1

