From patchwork Thu Dec 3 11:13:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Tyagi X-Patchwork-Id: 107171 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.11671.1796296699914308378 for ; Thu, 03 Dec 2026 03:18:19 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=pR+UeIvX; spf=pass (domain: gmail.com, ip: 209.85.216.48, mailfrom: ankur.tyagi85@gmail.com) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-3ae1da332bcso7066900a91.2 for ; Thu, 03 Dec 2026 03:18:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796296699; x=1796901499; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GBY2im3XbCUV2kTiw59aHwSYbcB/shuxAJgLZfel9Nc=; b=pR+UeIvX+dhAdltRF0cuDjWYPRbpGEpA3yEtjhJ1/5mUsAau8dtxm4hyN3SPD4BpC4 ng7Mxpov0X9eOvi+DI0fRAagRGCJ9+V4hZnDd26gAP3858PdFCI27jUfK4hBEkQht/57 xZdqteZUqRhEFfgVeEdFmTxV3hV1yS26G9l4XdDfBA9jcOxcw4mvPNTL+QFl0A+XpOJG 7BFLhIJnvrrXAR6qa6tvsBIZ23f/qnWMbvLgAn4CrFhIHP+KolQYu6+HVuqaK2f/yjwG QS5G4+UQVeMRa3W+ORAN6EcSUQapklqi23iqQqizWxAkE0EkEkA1uSSSsIeaXW28JcsI e4xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796296699; x=1796901499; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=GBY2im3XbCUV2kTiw59aHwSYbcB/shuxAJgLZfel9Nc=; b=CqTZ9DV7k1X61XXNT2vXrvYqH14i7yNSJkp8d9YBKQTCGJgJhGFVDxYtK4q0e74BCH IDLHDt60FV/6YRZmiUz/G4yPGRp2bE0M3OvT/PRKEwHkQWJTrpL6e60ZsXVqvORJQ4DH 0L/GoqnoK/8orCu/f+vpgXSbq56r13Jf3iINDK5UxxokhTw8A6UnfxiRXwoiglVxkuCU h/BRd13r/tw63OtjdB3V5VvUTjffUJndFcqhv26fylOA2HPRPoknAR8ZMdSqVAD7hKmO vLbaBygGcDsbniQYMA0lH2p5hB7HgBKpV7wsyNVdTKWd4d6h3yVBOryunl2aKEIKo/1r tVTw== X-Gm-Message-State: APuU4Z9q65oId+M+UTG7Sx1QTUnREDrtUCB9OB7auRa4YNLgeL7BiQrl mtmSWaUbU+UcJ0FABs8jievFErH4+CBqmcFbli2sHbQT2c6ETlNU+RqFKuTO8tIX X-Gm-Gg: AZFdTZeofNVmoD6zxtmD61x2FDtBN7EbP0jWt+Gyvm0Bl2mfZqaTrysZLAujljJbbP8 llrDeflewVVF//igMA3HrWpSdT99J4iIdJ5U56Zo/CSWMh07w2gmkzw200CctbfhNifApDbtpIf rhIGrqQuJ7VN04b3JRHRFkrpd9Pz9Opz8UUURr71UQpW4VifoTYqbCJTAVM/nfWrmNKmBvxnofq P8Q5xJ54noFtqECgObZFaHr6Yx0IVM9mNa6yP/fEgv6XlZmSMJ9MYE4n+qbrVuAVVXmtH4fUobZ MLUSI76nUQTTZC32ntGKlTCSISFgOK123w8Dn2jOorBD1ULhF2ZYOGj7FPlbMLlUHV0E04MRuvX iyFMdKwMfyO5duyRQCvrBhLbfpGZSAihJ/Aro7hqn6IzQy8YQTC8bWk+AWEQltxDgkBBo9xEcS/ wFyRO5sjWPuMOhaDExk9No4HpLXDRhi8pLDY+oZfUfTWrCX1xlBbWe2JcqPoISFitCl8x/A+oyE un7ddCmkp//sc+cnYQ1507mv/yxH6o2a8/Flf0ONDafCrKkUDNE1kJgkt1oF6ePntt0BIctWWAC +vi1pk/LttHNUEkVH6FrQDvqpmoEru3J/Q4Q0d3ErytOL/jABexCW9HC6FgI5SoxGReRghBrpi9 j16CDU7aw22whVyl1nR4PipApzb7PZzSllEAGm3XqQRg= X-Received: by 2002:a17:90b:4b85:b0:3ac:9d26:5532 with SMTP id 98e67ed59e1d1-3b41c7b5fa8mr44505715a91.3.1796296699097; Thu, 03 Dec 2026 03:18:19 -0800 (PST) Return-Path: Received: from NVAPF55DW0D-IPD.. ([147.161.219.8]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d65b94sm3890436a91.12.2026.12.03.03.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 03:18:18 -0800 (PST) From: ankur.tyagi85@gmail.com To: openembedded-devel@lists.openembedded.org Cc: Ankur Tyagi , Khem Raj Subject: [oe][meta-oe][blacksail][PATCH 75/95] psqlodbc: upgrade 18.00.0002 -> 18.00.0005 Date: Fri, 4 Dec 2026 00:13:46 +1300 Message-ID: <20261203111406.4182597-75-ankur.tyagi85@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261203111406.4182597-1-ankur.tyagi85@gmail.com> References: <20261203111406.4182597-1-ankur.tyagi85@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 11:18:21 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/133965 From: Ankur Tyagi Changelog: https://github.com/postgresql-interfaces/psqlodbc/releases/tag/REL-18_00_0005 Signed-off-by: Ankur Tyagi Signed-off-by: Khem Raj (cherry picked from commit e0a8836e333eba9893dfd90cec36aa2011a96f0b) Dropped patch that is part of the upstream version Signed-off-by: Ankur Tyagi --- .../psqlodbc/files/CVE-2026-109448.patch | 243 ------------------ ...c_18.00.0002.bb => psqlodbc_18.00.0005.bb} | 3 +- 2 files changed, 1 insertion(+), 245 deletions(-) delete mode 100644 meta-oe/recipes-dbs/psqlodbc/files/CVE-2026-109448.patch rename meta-oe/recipes-dbs/psqlodbc/{psqlodbc_18.00.0002.bb => psqlodbc_18.00.0005.bb} (96%) diff --git a/meta-oe/recipes-dbs/psqlodbc/files/CVE-2026-109448.patch b/meta-oe/recipes-dbs/psqlodbc/files/CVE-2026-109448.patch deleted file mode 100644 index 12f6cdd1d8..0000000000 --- a/meta-oe/recipes-dbs/psqlodbc/files/CVE-2026-109448.patch +++ /dev/null @@ -1,243 +0,0 @@ -From 5c9443fb0c8c0e263e1f8d0298987e91c4f5ccea Mon Sep 17 00:00:00 2001 -From: Dave Cramer -Date: Mon, 12 Oct 2026 11:47:08 -0400 -Subject: [PATCH] Merge commit from fork - -The APD, IPD and put-data binding counts are SQLSMALLINT. Binding -parameter 32768 wrapped the count to -32768, so execution failed with -07002 even though every parameter was bound; binding parameter 32769 -then extended the arrays with a memset starting at index -32768, -writing zeros up to 1.25 MiB before the start of the APD array (and -likewise for the IPD and put-data arrays), which corrupts the heap. - -SQLNumParams and SQL_DESC_COUNT are SQLSMALLINT too, so 32767 is the -largest parameter count ODBC can describe. PGAPI_BindParameter now -returns 07009 for parameter numbers outside 1..32767, which also covers -parameter number 0 for applications that call the driver without a -driver manager. - -New param-count-limit test binds 32767, 32768 and 32769 parameters. - -Assisted-By: Claude -(cherry picked from commit 86e4418e9553aa0891315db7531f8cd31eb1575e) - -CVE: CVE-2026-109448 -Upstream-Status: Backport [https://github.com/postgresql-interfaces/psqlodbc/commit/86e4418e9553aa0891315db7531f8cd31eb1575e] -Signed-off-by: Ankur Tyagi ---- - bind.c | 12 +++ - test/expected/param-count-limit.out | 12 +++ - test/src/param-count-limit-test.c | 142 ++++++++++++++++++++++++++++ - test/tests | 1 + - 4 files changed, 167 insertions(+) - create mode 100644 test/expected/param-count-limit.out - create mode 100644 test/src/param-count-limit-test.c - -diff --git a/bind.c b/bind.c -index 3b566ec..b3e5ca3 100644 ---- a/bind.c -+++ b/bind.c -@@ -16,6 +16,7 @@ - /* #include */ - #include - #include -+#include - #include "bind.h" - #include "misc.h" - -@@ -57,6 +58,17 @@ PGAPI_BindParameter(HSTMT hstmt, - } - SC_clear_error(stmt); - -+ /* -+ * The APD, IPD and put-data counts are SQLSMALLINT, like SQLNumParams -+ * and SQL_DESC_COUNT, so a larger parameter number would wrap the count -+ * negative and the next binding would write before the bindings array. -+ */ -+ if (ipar < 1 || ipar > SHRT_MAX) -+ { -+ SC_set_error(stmt, STMT_BAD_PARAMETER_NUMBER_ERROR, "Invalid parameter number for PGAPI_BindParameter.", func); -+ return SQL_ERROR; -+ } -+ - apdopts = SC_get_APDF(stmt); - if (apdopts->allocated < ipar) - extend_parameter_bindings(apdopts, ipar); -diff --git a/test/expected/param-count-limit.out b/test/expected/param-count-limit.out -new file mode 100644 -index 0000000..623bcbf ---- /dev/null -+++ b/test/expected/param-count-limit.out -@@ -0,0 +1,12 @@ -+connected -+APD SQL_DESC_COUNT=-1: error SQLSTATE=07009 -+APD bind 1 after SQL_DESC_COUNT=-1: ok -+IPD SQL_DESC_COUNT=-1: error SQLSTATE=07009 -+IPD bind 1 after SQL_DESC_COUNT=-1: ok -+bind 0: error SQLSTATE=07009 -+32767 params, bind 32767: ok -+32767 params, execute: ok -+32767 params, result 1 -+32768 params, bind 32768: error SQLSTATE=07009 -+32769 params, bind 32768: error SQLSTATE=07009 -+disconnecting -diff --git a/test/src/param-count-limit-test.c b/test/src/param-count-limit-test.c -new file mode 100644 -index 0000000..e9554cd ---- /dev/null -+++ b/test/src/param-count-limit-test.c -@@ -0,0 +1,142 @@ -+/* -+ * Test the limits on parameter numbers and descriptor counts. The driver -+ * keeps parameter binding counts in SQLSMALLINT, so SQLBindParameter with a -+ * parameter number above 32767, or SQL_DESC_COUNT set negative, used to -+ * wrap the count negative and make the next binding write zeros before the -+ * start of the bindings array. -+ */ -+#include -+#include -+#include -+ -+#include "common.h" -+ -+#define MAX_PARAMS 32767 -+ -+static void -+print_state(const char *what, SQLRETURN rc, SQLSMALLINT htype, SQLHANDLE h) -+{ -+ SQLCHAR state[6] = ""; -+ SQLINTEGER native; -+ SQLCHAR msg[256]; -+ SQLSMALLINT len; -+ -+ printf("%s: ", what); -+ if (SQL_SUCCEEDED(rc)) -+ { -+ printf("ok\n"); -+ return; -+ } -+ SQLGetDiagRec(htype, h, 1, state, &native, msg, sizeof(msg), &len); -+ printf("error SQLSTATE=%s\n", (char *) state); -+} -+ -+/* SELECT 1 WHERE 1 IN (?, ?, ..., ?) with nparams markers, all bound to 1 */ -+static void -+run_with_params(int nparams) -+{ -+ SQLRETURN rc; -+ HSTMT hstmt = SQL_NULL_HSTMT; -+ SQLINTEGER one = 1; -+ SQLINTEGER result = 0; -+ char *sql, *p; -+ char what[64]; -+ int i; -+ -+ rc = SQLAllocHandle(SQL_HANDLE_STMT, conn, &hstmt); -+ CHECK_CONN_RESULT(rc, "SQLAllocHandle failed", conn); -+ -+ sql = malloc(32 + 2 * nparams); -+ p = sql + sprintf(sql, "SELECT 1 WHERE 1 IN ("); -+ for (i = 0; i < nparams; i++) -+ { -+ if (i > 0) -+ *p++ = ','; -+ *p++ = '?'; -+ } -+ strcpy(p, ")"); -+ -+ for (i = 1; i <= nparams; i++) -+ { -+ rc = SQLBindParameter(hstmt, (SQLUSMALLINT) i, SQL_PARAM_INPUT, -+ SQL_C_SLONG, SQL_INTEGER, 0, 0, &one, 0, NULL); -+ if (!SQL_SUCCEEDED(rc)) -+ break; -+ } -+ snprintf(what, sizeof(what), "%d params, bind %d", nparams, i <= nparams ? i : nparams); -+ print_state(what, rc, SQL_HANDLE_STMT, hstmt); -+ -+ if (SQL_SUCCEEDED(rc)) -+ { -+ rc = SQLExecDirect(hstmt, (SQLCHAR *) sql, SQL_NTS); -+ snprintf(what, sizeof(what), "%d params, execute", nparams); -+ print_state(what, rc, SQL_HANDLE_STMT, hstmt); -+ } -+ if (SQL_SUCCEEDED(rc)) -+ { -+ rc = SQLBindCol(hstmt, 1, SQL_C_SLONG, &result, 0, NULL); -+ CHECK_STMT_RESULT(rc, "SQLBindCol failed", hstmt); -+ rc = SQLFetch(hstmt); -+ CHECK_STMT_RESULT(rc, "SQLFetch failed", hstmt); -+ printf("%d params, result %d\n", nparams, (int) result); -+ } -+ -+ free(sql); -+ SQLFreeHandle(SQL_HANDLE_STMT, hstmt); -+} -+ -+/* Set SQL_DESC_COUNT of the statement's APD or IPD to -1, then bind */ -+static void -+negative_desc_count(SQLINTEGER desc_attr, const char *desc_name) -+{ -+ SQLRETURN rc; -+ HSTMT hstmt = SQL_NULL_HSTMT; -+ SQLHDESC hdesc; -+ SQLINTEGER one = 1; -+ char what[64]; -+ -+ rc = SQLAllocHandle(SQL_HANDLE_STMT, conn, &hstmt); -+ CHECK_CONN_RESULT(rc, "SQLAllocHandle failed", conn); -+ -+ rc = SQLGetStmtAttr(hstmt, desc_attr, &hdesc, 0, NULL); -+ CHECK_STMT_RESULT(rc, "SQLGetStmtAttr failed", hstmt); -+ -+ rc = SQLSetDescField(hdesc, 0, SQL_DESC_COUNT, (SQLPOINTER) (SQLLEN) -1, 0); -+ snprintf(what, sizeof(what), "%s SQL_DESC_COUNT=-1", desc_name); -+ print_state(what, rc, SQL_HANDLE_DESC, hdesc); -+ -+ rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, -+ SQL_INTEGER, 0, 0, &one, 0, NULL); -+ snprintf(what, sizeof(what), "%s bind 1 after SQL_DESC_COUNT=-1", desc_name); -+ print_state(what, rc, SQL_HANDLE_STMT, hstmt); -+ -+ SQLFreeHandle(SQL_HANDLE_STMT, hstmt); -+} -+ -+int -+main(int argc, char **argv) -+{ -+ SQLRETURN rc; -+ HSTMT hstmt = SQL_NULL_HSTMT; -+ SQLINTEGER one = 1; -+ -+ test_connect(); -+ -+ negative_desc_count(SQL_ATTR_APP_PARAM_DESC, "APD"); -+ negative_desc_count(SQL_ATTR_IMP_PARAM_DESC, "IPD"); -+ -+ rc = SQLAllocHandle(SQL_HANDLE_STMT, conn, &hstmt); -+ CHECK_CONN_RESULT(rc, "SQLAllocHandle failed", conn); -+ rc = SQLBindParameter(hstmt, 0, SQL_PARAM_INPUT, SQL_C_SLONG, -+ SQL_INTEGER, 0, 0, &one, 0, NULL); -+ print_state("bind 0", rc, SQL_HANDLE_STMT, hstmt); -+ SQLFreeHandle(SQL_HANDLE_STMT, hstmt); -+ -+ run_with_params(MAX_PARAMS); -+ run_with_params(MAX_PARAMS + 1); -+ run_with_params(MAX_PARAMS + 2); -+ -+ test_disconnect(); -+ -+ return 0; -+} -diff --git a/test/tests b/test/tests -index 5074bca..c8af1ab 100644 ---- a/test/tests -+++ b/test/tests -@@ -63,6 +63,7 @@ TESTBINS = exe/connect-test \ - exe/descriptors-free-test \ - exe/primarykeys-include-test \ - exe/interval-overflow-test \ -+ exe/param-count-limit-test \ - exe/conn-settings-test \ - exe/percent-decode-test \ - exe/dbms-version-test \ diff --git a/meta-oe/recipes-dbs/psqlodbc/psqlodbc_18.00.0002.bb b/meta-oe/recipes-dbs/psqlodbc/psqlodbc_18.00.0005.bb similarity index 96% rename from meta-oe/recipes-dbs/psqlodbc/psqlodbc_18.00.0002.bb rename to meta-oe/recipes-dbs/psqlodbc/psqlodbc_18.00.0005.bb index 9756bcfad2..a770b60db1 100644 --- a/meta-oe/recipes-dbs/psqlodbc/psqlodbc_18.00.0002.bb +++ b/meta-oe/recipes-dbs/psqlodbc/psqlodbc_18.00.0005.bb @@ -23,11 +23,10 @@ SRC_URI = "git://github.com/postgresql-interfaces/psqlodbc.git;protocol=https;br file://psqlodbc-remove-some-checks-for-cross-compiling.patch \ file://psqlodbc-donot-use-the-hardcode-libdir.patch \ file://psqlodbc-fix-for-ptest-support.patch \ - file://CVE-2026-109448.patch \ file://run-ptest \ " -SRCREV = "95b35ac7cb2c9ea9df087fda08a695d89b8f8134" +SRCREV = "f6da5647355b110fc9cc005100e23ba980e20e33" PV_WITH_USCORE = "${@d.getVar('PV').replace('.', '_')}" DEPENDS += "postgresql unixodbc"