diff --git a/SOURCES/0002-sqlite-CVE-2025-6965.patch b/SOURCES/0002-sqlite-CVE-2025-6965.patch new file mode 100644 index 0000000..e8fabef --- /dev/null +++ b/SOURCES/0002-sqlite-CVE-2025-6965.patch @@ -0,0 +1,11026 @@ +diff --color -ruN node-v22.16.0/deps/sqlite/sqlite3.c node-modded/deps/sqlite/sqlite3.c +--- node-v22.16.0/deps/sqlite/sqlite3.c 2025-05-21 06:12:48.000000000 +0200 ++++ node-modded/deps/sqlite/sqlite3.c 2025-07-17 16:20:17.619643827 +0200 +@@ -1,6 +1,6 @@ + /****************************************************************************** + ** This file is an amalgamation of many separate C source files from SQLite +-** version 3.49.1. By combining all the individual C code files into this ++** version 3.50.3. By combining all the individual C code files into this + ** single large file, the entire code can be compiled as a single translation + ** unit. This allows many compilers to do optimizations that would not be + ** possible if the files were compiled separately. Performance improvements +@@ -18,7 +18,7 @@ + ** separate file. This file contains only code for the core SQLite library. + ** + ** The content in this amalgamation comes from Fossil check-in +-** 873d4e274b4988d260ba8354a9718324a1c2 with changes in files: ++** 3ce993b8657d6d9deda380a93cdd6404a8c8 with changes in files: + ** + ** + */ +@@ -452,7 +452,7 @@ + ** + ** Since [version 3.6.18] ([dateof:3.6.18]), + ** SQLite source code has been stored in the +-** Fossil configuration management ++** Fossil configuration management + ** system. ^The SQLITE_SOURCE_ID macro evaluates to + ** a string which identifies a particular check-in of SQLite + ** within its configuration management system. ^The SQLITE_SOURCE_ID +@@ -465,9 +465,9 @@ + ** [sqlite3_libversion_number()], [sqlite3_sourceid()], + ** [sqlite_version()] and [sqlite_source_id()]. + */ +-#define SQLITE_VERSION "3.49.1" +-#define SQLITE_VERSION_NUMBER 3049001 +-#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70" ++#define SQLITE_VERSION "3.50.3" ++#define SQLITE_VERSION_NUMBER 3050003 ++#define SQLITE_SOURCE_ID "2025-07-17 13:25:10 3ce993b8657d6d9deda380a93cdd6404a8c8ba1b185b2bc423703e41ae5f2543" + + /* + ** CAPI3REF: Run-Time Library Version Numbers +@@ -1482,6 +1482,12 @@ + ** the value that M is to be set to. Before returning, the 32-bit signed + ** integer is overwritten with the previous value of M. + ** ++**
  • [[SQLITE_FCNTL_BLOCK_ON_CONNECT]] ++** The [SQLITE_FCNTL_BLOCK_ON_CONNECT] opcode is used to configure the ++** VFS to block when taking a SHARED lock to connect to a wal mode database. ++** This is used to implement the functionality associated with ++** SQLITE_SETLK_BLOCK_ON_CONNECT. ++** + **
  • [[SQLITE_FCNTL_DATA_VERSION]] + ** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to + ** a database file. The argument is a pointer to a 32-bit unsigned integer. +@@ -1578,6 +1584,7 @@ + #define SQLITE_FCNTL_CKSM_FILE 41 + #define SQLITE_FCNTL_RESET_CACHE 42 + #define SQLITE_FCNTL_NULL_IO 43 ++#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44 + + /* deprecated names */ + #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE +@@ -2308,13 +2315,16 @@ + ** + ** [[SQLITE_CONFIG_LOOKASIDE]]
    SQLITE_CONFIG_LOOKASIDE
    + **
    ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine +-** the default size of lookaside memory on each [database connection]. ++** the default size of [lookaside memory] on each [database connection]. + ** The first argument is the +-** size of each lookaside buffer slot and the second is the number of +-** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE +-** sets the default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] +-** option to [sqlite3_db_config()] can be used to change the lookaside +-** configuration on individual connections.)^
    ++** size of each lookaside buffer slot ("sz") and the second is the number of ++** slots allocated to each database connection ("cnt").)^ ++** ^(SQLITE_CONFIG_LOOKASIDE sets the default lookaside size. ++** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can ++** be used to change the lookaside configuration on individual connections.)^ ++** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the ++** default lookaside configuration at compile-time. ++** + ** + ** [[SQLITE_CONFIG_PCACHE2]]
    SQLITE_CONFIG_PCACHE2
    + **
    ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is +@@ -2551,31 +2561,50 @@ + ** [[SQLITE_DBCONFIG_LOOKASIDE]] + **
    SQLITE_DBCONFIG_LOOKASIDE
    + **
    The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the +-** configuration of the lookaside memory allocator within a database ++** configuration of the [lookaside memory allocator] within a database + ** connection. + ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are not + ** in the [DBCONFIG arguments|usual format]. + ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, + ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE + ** should have a total of five parameters. +-** ^The first argument (the third parameter to [sqlite3_db_config()] is a ++**
      ++**
    1. The first argument ("buf") is a + ** pointer to a memory buffer to use for lookaside memory. +-** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb +-** may be NULL in which case SQLite will allocate the +-** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the +-** size of each lookaside buffer slot. ^The third argument is the number of +-** slots. The size of the buffer in the first argument must be greater than +-** or equal to the product of the second and third arguments. The buffer +-** must be aligned to an 8-byte boundary. ^If the second argument to +-** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally +-** rounded down to the next smaller multiple of 8. ^(The lookaside memory ++** The first argument may be NULL in which case SQLite will allocate the ++** lookaside buffer itself using [sqlite3_malloc()]. ++**

    2. The second argument ("sz") is the ++** size of each lookaside buffer slot. Lookaside is disabled if "sz" ++** is less than 8. The "sz" argument should be a multiple of 8 less than ++** 65536. If "sz" does not meet this constraint, it is reduced in size until ++** it does. ++**

    3. The third argument ("cnt") is the number of slots. Lookaside is disabled ++** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so ++** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt" ++** parameter is usually chosen so that the product of "sz" and "cnt" is less ++** than 1,000,000. ++**

    ++**

    If the "buf" argument is not NULL, then it must ++** point to a memory buffer with a size that is greater than ++** or equal to the product of "sz" and "cnt". ++** The buffer must be aligned to an 8-byte boundary. ++** The lookaside memory + ** configuration for a database connection can only be changed when that + ** connection is not currently using lookaside memory, or in other words +-** when the "current value" returned by +-** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero. ++** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero. + ** Any attempt to change the lookaside memory configuration when lookaside + ** memory is in use leaves the configuration unchanged and returns +-** [SQLITE_BUSY].)^

    ++** [SQLITE_BUSY]. ++** If the "buf" argument is NULL and an attempt ++** to allocate memory based on "sz" and "cnt" fails, then ++** lookaside is silently disabled. ++**

    ++** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the ++** default lookaside configuration at initialization. The ++** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside ++** configuration at compile-time. Typical values for lookaside are 1200 for ++** "sz" and 40 to 100 for "cnt". ++** + ** + ** [[SQLITE_DBCONFIG_ENABLE_FKEY]] + **

    SQLITE_DBCONFIG_ENABLE_FKEY
    +@@ -3313,6 +3342,44 @@ + SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); + + /* ++** CAPI3REF: Set the Setlk Timeout ++** METHOD: sqlite3 ++** ++** This routine is only useful in SQLITE_ENABLE_SETLK_TIMEOUT builds. If ++** the VFS supports blocking locks, it sets the timeout in ms used by ++** eligible locks taken on wal mode databases by the specified database ++** handle. In non-SQLITE_ENABLE_SETLK_TIMEOUT builds, or if the VFS does ++** not support blocking locks, this function is a no-op. ++** ++** Passing 0 to this function disables blocking locks altogether. Passing ++** -1 to this function requests that the VFS blocks for a long time - ++** indefinitely if possible. The results of passing any other negative value ++** are undefined. ++** ++** Internally, each SQLite database handle store two timeout values - the ++** busy-timeout (used for rollback mode databases, or if the VFS does not ++** support blocking locks) and the setlk-timeout (used for blocking locks ++** on wal-mode databases). The sqlite3_busy_timeout() method sets both ++** values, this function sets only the setlk-timeout value. Therefore, ++** to configure separate busy-timeout and setlk-timeout values for a single ++** database handle, call sqlite3_busy_timeout() followed by this function. ++** ++** Whenever the number of connections to a wal mode database falls from ++** 1 to 0, the last connection takes an exclusive lock on the database, ++** then checkpoints and deletes the wal file. While it is doing this, any ++** new connection that tries to read from the database fails with an ++** SQLITE_BUSY error. Or, if the SQLITE_SETLK_BLOCK_ON_CONNECT flag is ++** passed to this API, the new connection blocks until the exclusive lock ++** has been released. ++*/ ++SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags); ++ ++/* ++** CAPI3REF: Flags for sqlite3_setlk_timeout() ++*/ ++#define SQLITE_SETLK_BLOCK_ON_CONNECT 0x01 ++ ++/* + ** CAPI3REF: Convenience Routines For Running Queries + ** METHOD: sqlite3 + ** +@@ -4331,7 +4398,7 @@ + ** + ** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of + ** database filename D with corresponding journal file J and WAL file W and +-** with N URI parameters key/values pairs in the array P. The result from ++** an array P of N URI Key/Value pairs. The result from + ** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that + ** is safe to pass to routines like: + **