[SCM] PostGIS branch master updated. 3.6.0rc2-591-gb90c3dbb1

git at osgeo.org git at osgeo.org
Thu Jun 18 05:48:00 PDT 2026


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  b90c3dbb175c92ea3c113c38cacc6a3617a51695 (commit)
       via  67d6df38c343a8be4605061e330587d9aafaffaf (commit)
      from  ea9c759b0b8d6c9b27fa5e12c5bb0be8b3405c66 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b90c3dbb175c92ea3c113c38cacc6a3617a51695
Merge: ea9c759b0 67d6df38c
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jun 18 16:46:19 2026 +0400

    Merge PR #932: Mark truncated PostgreSQL messages
    
    Make libpgcommon append a truncation marker when fixed-size PostgreSQL message formatting overflows, so error, warning, notice, and debug messages no longer lose their tail silently.

diff --cc NEWS
index a314e2be7,2910943b4..5ca8c2631
--- a/NEWS
+++ b/NEWS
@@@ -55,9 -54,8 +55,11 @@@ To take advantage of all postgis_sfcga
            finite coordinates (Darafei Praliaskouski)
   - GH-892, Add OSS-Fuzz coverage for TWKB and serialized raster inputs,
            including guards for malformed TWKB reads and counts (Darafei Praliaskouski)
 + - GH-888, [sfcgal] Avoid stale detoasted geometry access in
 +          CG_Visibility empty-input handling for SFCGAL < 2.2
 +          (Darafei Praliaskouski)
+  - #3179, Mark truncated libpgcommon PostgreSQL messages instead of silently
+           dropping the tail (Darafei Praliaskouski)
   - Build PostgreSQL extension modules with `-fno-semantic-interposition` when
            available so LTO can optimize same-DSO calls to exported PostGIS
            entry points directly instead of routing through the module PLT; in

commit 67d6df38c343a8be4605061e330587d9aafaffaf
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Wed Jun 17 09:57:39 2026 +0400

    libpgcommon: mark truncated PostgreSQL messages

diff --git a/NEWS b/NEWS
index 4cd72746a..2910943b4 100644
--- a/NEWS
+++ b/NEWS
@@ -54,6 +54,8 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
           finite coordinates (Darafei Praliaskouski)
  - GH-892, Add OSS-Fuzz coverage for TWKB and serialized raster inputs,
           including guards for malformed TWKB reads and counts (Darafei Praliaskouski)
+ - #3179, Mark truncated libpgcommon PostgreSQL messages instead of silently
+          dropping the tail (Darafei Praliaskouski)
  - Build PostgreSQL extension modules with `-fno-semantic-interposition` when
           available so LTO can optimize same-DSO calls to exported PostGIS
           entry points directly instead of routing through the module PLT; in
diff --git a/libpgcommon/lwgeom_pg.c b/libpgcommon/lwgeom_pg.c
index fbbe5b73b..d2e2fd061 100644
--- a/libpgcommon/lwgeom_pg.c
+++ b/libpgcommon/lwgeom_pg.c
@@ -43,8 +43,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <string.h>
 
 #define PGC_ERRMSG_MAXLEN 2048 //256
+#define PGC_ERRMSG_TRUNCATED " [truncated]"
 
 /****************************************************************************************/
 /* Global to hold all the run-time constants */
@@ -350,6 +352,28 @@ pg_free(void *ptr)
 	pfree(ptr);
 }
 
+static void
+pg_format_message(char *errmsg, size_t errmsg_size, const char *fmt, va_list ap)
+{
+	int written = vsnprintf(errmsg, errmsg_size, fmt, ap);
+
+	if (written < 0)
+	{
+		strlcpy(errmsg, "[error formatting PostGIS message]", errmsg_size);
+		return;
+	}
+
+	if ((size_t)written >= errmsg_size)
+	{
+		const size_t suffix_size = strlen(PGC_ERRMSG_TRUNCATED);
+
+		if (errmsg_size > suffix_size)
+			memcpy(errmsg + errmsg_size - suffix_size - 1,
+			       PGC_ERRMSG_TRUNCATED,
+			       suffix_size + 1);
+	}
+}
+
 static void pg_error(const char *fmt, va_list ap) __attribute__ (( format(printf, 1, 0) ));
 
 static void
@@ -357,9 +381,7 @@ pg_error(const char *fmt, va_list ap)
 {
 	char errmsg[PGC_ERRMSG_MAXLEN+1];
 
-	vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap);
-
-	errmsg[PGC_ERRMSG_MAXLEN]='\0';
+	pg_format_message(errmsg, sizeof(errmsg), fmt, ap);
 	ereport(ERROR, (errmsg_internal("%s", errmsg)));
 }
 
@@ -370,9 +392,7 @@ pg_warning(const char *fmt, va_list ap)
 {
 	char errmsg[PGC_ERRMSG_MAXLEN+1];
 
-	vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap);
-
-	errmsg[PGC_ERRMSG_MAXLEN]='\0';
+	pg_format_message(errmsg, sizeof(errmsg), fmt, ap);
 	ereport(WARNING, (errmsg_internal("%s", errmsg)));
 }
 
@@ -383,9 +403,7 @@ pg_notice(const char *fmt, va_list ap)
 {
 	char errmsg[PGC_ERRMSG_MAXLEN+1];
 
-	vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap);
-
-	errmsg[PGC_ERRMSG_MAXLEN]='\0';
+	pg_format_message(errmsg, sizeof(errmsg), fmt, ap);
 	ereport(NOTICE, (errmsg_internal("%s", errmsg)));
 }
 
@@ -395,8 +413,7 @@ static void
 pg_debug(int level, const char *fmt, va_list ap)
 {
 	char errmsg[PGC_ERRMSG_MAXLEN+1];
-	vsnprintf (errmsg, PGC_ERRMSG_MAXLEN, fmt, ap);
-	errmsg[PGC_ERRMSG_MAXLEN]='\0';
+	pg_format_message(errmsg, sizeof(errmsg), fmt, ap);
 	int pglevel[6] = {NOTICE, DEBUG1, DEBUG2, DEBUG3, DEBUG4, DEBUG5};
 
 	if ( level >= 0 && level <= 5 )

-----------------------------------------------------------------------

Summary of changes:
 NEWS                    |  2 ++
 libpgcommon/lwgeom_pg.c | 39 ++++++++++++++++++++++++++++-----------
 2 files changed, 30 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list