[SCM] PostGIS branch master updated. 3.6.0rc2-351-gab39a258b

git at osgeo.org git at osgeo.org
Wed Mar 4 12:02:01 PST 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  ab39a258bf1f6ec872452b313564d34ea5805a4c (commit)
      from  f0af9121d32fc84d7fc4bcb4db79f26e7abfd74c (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 ab39a258bf1f6ec872452b313564d34ea5805a4c
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Wed Mar 4 23:57:21 2026 +0400

    fuzzers: centralize OSS-Fuzz build flow in PostGIS
    
    Move OSS-Fuzz project logic into PostGIS-owned scripts so oss-fuzz keeps only thin wrappers.
    
    Highlights:
    - add fuzzers/build_oss_fuzz.sh as the single OSS-Fuzz entrypoint
    - add fuzzers/install_oss_fuzz_build_deps.sh for builder image apt dependencies
    - make build_google_oss_fuzzers.sh use portable link flags (pkg-config/geos-config)
    - fold runtime .so packaging/RPATH setup into build_google_oss_fuzzers.sh
    - prefer provided CXX over pg_config --cc for Wagyu/FlatGeobuf checks
    - rename fuzzers/README.TXT to README.md and refresh docs/issue links
    - document the change in NEWS

diff --git a/NEWS b/NEWS
index eac939a70..6ed876e0c 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,10 @@ This version requires GEOS 3.10 or higher
  - #5593, Docs: render manual images with GraphicsMagick without temporary files,
           enabling parallel builds, keeping ImageMagick fallbacks working, and
           documenting the generator workflow for contributors (Darafei Praliaskouski)
+ - [fuzzers] Centralize OSS-Fuzz build/dependency logic in PostGIS scripts,
+          prefer requested CXX over pg_config --cc for internal C++ checks, and
+          make fuzzer linking/runtime dependency packaging portable
+          (Darafei Praliaskouski)
  - GH-848, CG_AlphaShape now returns a MultiPolygon (Jean Felder)
 
 PostGIS 3.6.0
@@ -3061,5 +3065,3 @@ PostGIS 0.1
 - truely_inside()
 - rtree index support functions
 - gist index support functions
-
-
diff --git a/configure.ac b/configure.ac
index 6a01d656f..d5fb6cc1b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1774,7 +1774,7 @@ if test "x$HAVE_PROTOBUF" = "xyes"; then
     AC_SUBST([WAGYU_LIB])
 
     dnl ============================================================
-    dnl We force  to use the same compiler as Postgresql
+    dnl Prefer user/toolchain CXX, falling back to PostgreSQL compiler when needed.
     dnl ============================================================
     CXX_SAVE="$CXX"
     CC_SAVE="$CC"
@@ -1784,7 +1784,13 @@ if test "x$HAVE_PROTOBUF" = "xyes"; then
     LDFLAGS_SAVE="$LDFLAGS"
     LIBS_SAVE="$LIBS"
 
-    WAGYU_CXX=`"$PG_CONFIG" --cc`
+    dnl Prefer the requested C++ toolchain when provided (for example by OSS-Fuzz),
+    dnl and only fall back to PostgreSQL's compiler when CXX is unset.
+    if test "x$CXX_SAVE" != "x"; then
+        WAGYU_CXX="$CXX_SAVE"
+    else
+        WAGYU_CXX=`"$PG_CONFIG" --cc`
+    fi
     CPPFLAGS="-x c++"
     CFLAGS=""
     LDFLAGS=""
@@ -1847,7 +1853,7 @@ FLATGEOBUF_LIB=libflatgeobuf.la
 AC_SUBST([FLATGEOBUF_LIB])
 
 dnl ============================================================
-dnl We force  to use the same compiler as Postgresql
+dnl Prefer user/toolchain CXX, falling back to PostgreSQL compiler when needed.
 dnl ============================================================
 CXX_SAVE="$CXX"
 CC_SAVE="$CC"
@@ -1857,7 +1863,11 @@ CPPFLAGS_SAVE="$CPPFLAGS"
 LDFLAGS_SAVE="$LDFLAGS"
 LIBS_SAVE="$LIBS"
 
-FLATGEOBUF_CXX=`"$PG_CONFIG" --cc`
+if test "x$CXX_SAVE" != "x"; then
+	FLATGEOBUF_CXX="$CXX_SAVE"
+else
+	FLATGEOBUF_CXX=`"$PG_CONFIG" --cc`
+fi
 CPPFLAGS="-x c++"
 CFLAGS=""
 LDFLAGS=""
diff --git a/fuzzers/README.TXT b/fuzzers/README.TXT
deleted file mode 100644
index df858ea2d..000000000
--- a/fuzzers/README.TXT
+++ /dev/null
@@ -1,38 +0,0 @@
-This directory contains fuzzer main functions and scripts for the
-Google OSS Fuzz project: https://github.com/google/oss-fuzz/
-
-The main build scripts are in:
-https://github.com/google/oss-fuzz/tree/master/projects/postgis
-and call scripts in this directory.
-
-The list of issues is in:
-https://bugs.chromium.org/p/oss-fuzz/issues/list?q=postgis
-
-- Simulate the build of (dummy) fuzzers like OSS Fuzz does:
-    $ make dummyfuzzers
-  They are created in /tmp/*_fuzzer as well as with the
-  /tmp/*_fuzzer_seed_corpus.zip files
-
-  Run one:
-    $ /tmp/wkt_import_fuzzer a_file_name
-
-- Run locally OSS Fuzz:
-    $ git clone --depth=1  https://github.com/google/oss-fuzz.git
-    $ cd oss-fuzz
-    $ python infra/helper.py build_image postgis
-
-  Build fuzzers with the address sanitizer (could use undefined, etc...)
-    $ python infra/helper.py build_fuzzers --sanitizer address postgis
-
-  Test a particular fuzzer (replace wkt_import_fuzzer by other fuzzers
-  like the ones generated in /tmp by "make dummyfuzzers")
-    $ python infra/helper.py run_fuzzer postgis wkt_import_fuzzer
-
-
-How to deal with issues reported in https://bugs.chromium.org/p/oss-fuzz/issues/list?q=postgis ?
-
-    1. Leave a comment in (chromium database) bug entry to indicate that you work on it
-    2. Work
-    3. Commit a bug fix with log including "Credit to OSS-Fuzz" and a link to the bugs.chromium.org ticket
-    4. Add in the bugs.chromium.org ticket a link to the Trac changeset implementing the fix.
-    5. Check chromium closed the bug (after one or two days typically)
diff --git a/fuzzers/README.md b/fuzzers/README.md
new file mode 100644
index 000000000..0c167e4f3
--- /dev/null
+++ b/fuzzers/README.md
@@ -0,0 +1,64 @@
+# PostGIS Fuzzers
+
+This directory contains fuzzer entry points and helper scripts for the
+[Google OSS-Fuzz project](https://github.com/google/oss-fuzz/).
+
+## OSS-Fuzz Build Entrypoint
+
+The main OSS-Fuzz build orchestration lives in:
+
+- `./fuzzers/build_oss_fuzz.sh`
+
+The wrapper in
+[`oss-fuzz/projects/postgis`](https://github.com/google/oss-fuzz/tree/master/projects/postgis)
+should call this script.
+
+## OSS-Fuzz Image Dependencies
+
+The package list for the OSS-Fuzz builder image lives in:
+
+- `./fuzzers/install_oss_fuzz_build_deps.sh`
+
+The `oss-fuzz` project `Dockerfile` should call this script during image build.
+
+## Issues
+
+- [PostGIS OSS-Fuzz issue list](https://issues.oss-fuzz.com/issues?q=postgis)
+
+## Local Workflow
+
+### Simulate Dummy Fuzzer Build
+
+```bash
+make dummyfuzzers
+```
+
+Artifacts are created in `/tmp`:
+
+- `/tmp/*_fuzzer`
+- `/tmp/*_fuzzer_seed_corpus.zip`
+- Runtime shared libraries in `/tmp/lib` (when available)
+
+Run one fuzzer locally:
+
+```bash
+/tmp/wkt_import_fuzzer a_file_name
+```
+
+### Run OSS-Fuzz Locally
+
+```bash
+git clone --depth=1 https://github.com/google/oss-fuzz.git
+cd oss-fuzz
+python infra/helper.py build_image postgis
+python infra/helper.py build_fuzzers --sanitizer address postgis
+python infra/helper.py run_fuzzer postgis wkt_import_fuzzer
+```
+
+## Handling Reported OSS-Fuzz Issues
+
+1. Leave a comment in the bug entry to indicate that you are working on it.
+2. Implement the fix.
+3. Commit with a message including `Credit to OSS-Fuzz` and a link to the OSS-Fuzz ticket.
+4. Add a link to the implementing changeset/commit in the OSS-Fuzz ticket.
+5. Verify OSS-Fuzz closes the bug (usually within a day or two).
diff --git a/fuzzers/build_google_oss_fuzzers.sh b/fuzzers/build_google_oss_fuzzers.sh
index cca450323..4f1435c24 100755
--- a/fuzzers/build_google_oss_fuzzers.sh
+++ b/fuzzers/build_google_oss_fuzzers.sh
@@ -18,6 +18,11 @@ if [ "$CXX" == "" ]; then
 fi
 
 SRC_DIR=$(dirname $0)/..
+JSON_C_LIBS=$(pkg-config --libs json-c)
+GEOS_LIBS=$(geos-config --clibs)
+PROJ_XML2_LIBS=$(pkg-config --libs proj libxml-2.0)
+POSTGIS_FUZZER_LIBS="$JSON_C_LIBS $GEOS_LIBS $PROJ_XML2_LIBS"
+POSTGIS_PACKAGE_RUNTIME_LIBS="${POSTGIS_PACKAGE_RUNTIME_LIBS:-1}"
 
 build_fuzzer()
 {
@@ -28,7 +33,37 @@ build_fuzzer()
     echo "Building fuzzer $fuzzerName"
     $CXX $CXXFLAGS -std=c++11 -I$SRC_DIR/liblwgeom \
         $sourceFilename $* -o $OUT/$fuzzerName \
-        -lFuzzingEngine -lstdc++ $SRC_DIR/liblwgeom/.libs/liblwgeom.a /usr/lib/x86_64-linux-gnu/libjson-c.a
+        -lFuzzingEngine -lstdc++ $SRC_DIR/liblwgeom/.libs/liblwgeom.a $POSTGIS_FUZZER_LIBS
+}
+
+package_runtime_libs()
+{
+    mkdir -p "$OUT/lib"
+
+    for fuzzer in "$OUT"/*_fuzzer; do
+        [ -f "$fuzzer" ] || continue
+
+        if command -v patchelf >/dev/null 2>&1; then
+            patchelf --set-rpath '$ORIGIN/lib' "$fuzzer"
+        fi
+
+        while read -r lib; do
+            [ -f "$lib" ] || continue
+
+            base="$(basename "$lib")"
+            case "$base" in
+                libc.so.*|libm.so.*|libdl.so.*|libpthread.so.*|librt.so.*|libgcc_s.so.*|ld-linux*.so.*|linux-vdso.so.*|libresolv.so.*)
+                    continue
+                    ;;
+            esac
+
+            cp -n "$lib" "$OUT/lib/" || true
+        done < <(ldd "$fuzzer" | awk '/=> \// {print $3}')
+    done
+
+    if command -v patchelf >/dev/null 2>&1; then
+        patchelf --set-rpath '$ORIGIN' "$OUT"/lib/*.so* 2>/dev/null || true
+    fi
 }
 
 fuzzerFiles=$(dirname $0)/*.cpp
@@ -38,3 +73,7 @@ for F in $fuzzerFiles; do
 done
 
 cp $(dirname $0)/*.dict $(dirname $0)/*.options $(dirname $0)/*.zip $OUT/
+
+if [ "$POSTGIS_PACKAGE_RUNTIME_LIBS" != "0" ]; then
+    package_runtime_libs
+fi
diff --git a/fuzzers/build_oss_fuzz.sh b/fuzzers/build_oss_fuzz.sh
new file mode 100755
index 000000000..5b65ddcda
--- /dev/null
+++ b/fuzzers/build_oss_fuzz.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+set -e
+
+if [ "$CC" == "" ]; then
+    echo "CC env var not defined"
+    exit 1
+fi
+
+if [ "$CXX" == "" ]; then
+    echo "CXX env var not defined"
+    exit 1
+fi
+
+if [ "$OUT" == "" ]; then
+    echo "OUT env var not defined"
+    exit 1
+fi
+
+FUZZERS_DIR=$(cd "$(dirname "$0")" && pwd)
+SRC_DIR=$(dirname "$FUZZERS_DIR")
+mkdir -p "$OUT"
+
+if [ "$SRC" == "" ]; then
+    export SRC="$SRC_DIR"
+fi
+
+export CXXFLAGS="$CXXFLAGS -std=c++11"
+POSTGIS_OSS_FUZZ_CONFIGURE_FLAGS=(
+    --enable-static
+    --without-raster
+    --without-protobuf
+    --enable-debug
+)
+
+cd "$SRC_DIR"
+./autogen.sh
+./configure CC="$CC" CXX="$CXX" "${POSTGIS_OSS_FUZZ_CONFIGURE_FLAGS[@]}"
+cd liblwgeom
+make clean -s
+make -j"$(nproc)" -s
+cd ..
+
+bash ./fuzzers/build_google_oss_fuzzers.sh
+bash ./fuzzers/build_seed_corpus.sh
diff --git a/fuzzers/install_oss_fuzz_build_deps.sh b/fuzzers/install_oss_fuzz_build_deps.sh
new file mode 100755
index 000000000..992d20369
--- /dev/null
+++ b/fuzzers/install_oss_fuzz_build_deps.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+set -e
+
+if ! command -v apt-get >/dev/null 2>&1; then
+    echo "apt-get not found"
+    exit 1
+fi
+
+if [ "$(id -u)" -ne 0 ]; then
+    echo "This script must run as root inside the OSS-Fuzz builder image"
+    exit 1
+fi
+
+export DEBIAN_FRONTEND="${DEBIAN_FRONTEND:-noninteractive}"
+
+apt-get update
+apt-get install -y --no-install-recommends \
+    make autoconf automake libtool g++ postgresql-server-dev-all \
+    libgeos-dev libproj-dev libxml2-dev pkg-config libjson-c-dev \
+    libc++-dev libc++abi-dev patchelf
+
+rm -rf /var/lib/apt/lists/*

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

Summary of changes:
 NEWS                                   |  6 ++--
 configure.ac                           | 18 +++++++---
 fuzzers/README.TXT                     | 38 --------------------
 fuzzers/README.md                      | 64 ++++++++++++++++++++++++++++++++++
 fuzzers/build_google_oss_fuzzers.sh    | 41 +++++++++++++++++++++-
 fuzzers/build_oss_fuzz.sh              | 45 ++++++++++++++++++++++++
 fuzzers/install_oss_fuzz_build_deps.sh | 23 ++++++++++++
 7 files changed, 190 insertions(+), 45 deletions(-)
 delete mode 100644 fuzzers/README.TXT
 create mode 100644 fuzzers/README.md
 create mode 100755 fuzzers/build_oss_fuzz.sh
 create mode 100755 fuzzers/install_oss_fuzz_build_deps.sh


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list