Skip to content

Commit 379d109

Browse files
jkleinscclaude
andcommitted
fix(patch): silence sign-compare warning in sessionVarintGetSafe
Cast int nBuf to size_t when comparing with sizeof(aCopy) so the bundled sqlite3 amalgamation compiles under -Werror,-Wsign-compare. Ref: nodejs/node#62699 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 07827c6 commit 379d109

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

patches/node/.patches

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ fix_preserve_node_symbols_and_vtables_under_thinlto.patch
4848
electron_build-time_v8_code_cache_for_the_electron_js2c_bundles.patch
4949
electron_enable_node_startup_snapshot_generation_in_chromium_s_v8.patch
5050
chore_cast_const_away_when_freeing_uv_cpu_info_t_model.patch
51+
chore_silence_sign-compare_warning_in_sessionvarintgetsafe.patch
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: John Kleinschmidt <jkleinsc@electronjs.org>
3+
Date: Mon, 1 Jun 2026 11:39:31 -0400
4+
Subject: chore: silence sign-compare warning in sessionVarintGetSafe
5+
6+
Upstream sqlite compares signed 'int nBuf' against 'sizeof(aCopy)'
7+
(size_t). Electron builds with -Wsign-compare as an error, so cast
8+
nBuf to size_t to silence the warning. Callers always pass a
9+
non-negative value so this preserves behavior.
10+
11+
This patch can be removed once sqlite fixes the comparison upstream.
12+
13+
diff --git a/deps/sqlite/sqlite3.c b/deps/sqlite/sqlite3.c
14+
index 91db04a9ecdc54cc4a8c225f91f8dd593e240c2e..235bb054dc356a37281a0406d3952c8e8eb6b47d 100644
15+
--- a/deps/sqlite/sqlite3.c
16+
+++ b/deps/sqlite/sqlite3.c
17+
@@ -233670,7 +233670,7 @@ static int sessionVarintGetSafe(const u8 *aBuf, int nBuf, int *piVal){
18+
u8 aCopy[9];
19+
const u8 *aRead = aBuf;
20+
memset(aCopy, 0, sizeof(aCopy));
21+
- if( nBuf<sizeof(aCopy) ){
22+
+ if( (size_t)nBuf<sizeof(aCopy) ){
23+
memcpy(aCopy, aBuf, nBuf);
24+
aRead = aCopy;
25+
}

0 commit comments

Comments
 (0)