[SCM] PostGIS branch master updated. 3.7.0beta1-242-gd44fea5336

git at osgeo.org git at osgeo.org
Sat Aug 8 01:33:47 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  d44fea5336f85fde27e59e4bd82d210a6c671f80 (commit)
       via  491813e413afff546779b988e79ad7eb20559c46 (commit)
      from  14f1002deb9776219ad069045daec1fe7f5173fc (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 d44fea5336f85fde27e59e4bd82d210a6c671f80
Merge: 14f1002deb 491813e413
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date:   Sat Aug 8 01:33:46 2026 -0700

    Merge pull request 'liblwgeom: reject truncated encoded polylines' (!667) from Komzpa/postgis:fix/encoded-polyline-bounds-540137187 into master
    
    ## Summary
    
    Reject truncated encoded polyline input before `lwgeom_from_encoded_polyline`
    reads beyond the supplied string.
    
    The decoder now checks bounds for both coordinate varints and reports malformed
    input. The new CUnit cases cover a missing longitude and an unterminated
    latitude varint.
    
    ## Validation
    
    - `make -C liblwgeom -j32`
    - `make -C liblwgeom/cunit -j32 cu_tester`
    - `./liblwgeom/cunit/cu_tester encoded_polyline_input`
    
    Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/667


commit 491813e413afff546779b988e79ad7eb20559c46
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Sat Aug 8 12:22:14 2026 +0400

    fix(liblwgeom): reject truncated encoded polylines

diff --git a/NEWS b/NEWS
index 6f297904d6..0bb868dbe9 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ These are only changes since 3.7.0beta1.
           where it could deadlock with autovacuum (Darafei Praliaskouski)
  - [liblwgeom] Reject malformed GSERIALIZED NURBS before curve
           evaluation (Darafei Praliaskouski)
+ - OSSFuzz 5877056525893632, reject truncated encoded polyline input
+          (Darafei Praliaskouski)
  - GT-619, Make interrupt regression tests compare timeout latency to
           same-machine uninterrupted runtime, avoiding false failures under
           slow CI load (Darafei Praliaskouski)
diff --git a/liblwgeom/cunit/cu_in_encoded_polyline.c b/liblwgeom/cunit/cu_in_encoded_polyline.c
index 6af16b9a23..9cd4a7e1fe 100644
--- a/liblwgeom/cunit/cu_in_encoded_polyline.c
+++ b/liblwgeom/cunit/cu_in_encoded_polyline.c
@@ -62,6 +62,13 @@ static void in_encoded_polyline_test_close_points(void)
 		"SRID=4326;LINESTRING(38.903876 55.336448,38.903875 55.336448)");
 }
 
+static void in_encoded_polyline_test_truncated_input(void)
+{
+	/* A latitude without a longitude and an unterminated latitude varint. */
+	CU_ASSERT_PTR_NULL(lwgeom_from_encoded_polyline("A", 5));
+	CU_ASSERT_PTR_NULL(lwgeom_from_encoded_polyline("`", 5));
+}
+
 /*
 ** Used by test harness to register the tests in this file.
 */
@@ -72,4 +79,5 @@ void in_encoded_polyline_suite_setup(void)
 	PG_ADD_TEST(suite, in_encoded_polyline_test_geoms);
 	PG_ADD_TEST(suite, in_encoded_polyline_test_precision);
 	PG_ADD_TEST(suite, in_encoded_polyline_test_close_points);
+	PG_ADD_TEST(suite, in_encoded_polyline_test_truncated_input);
 }
diff --git a/liblwgeom/lwin_encoded_polyline.c b/liblwgeom/lwin_encoded_polyline.c
index 2bb9f73417..d1af103eab 100644
--- a/liblwgeom/lwin_encoded_polyline.c
+++ b/liblwgeom/lwin_encoded_polyline.c
@@ -29,6 +29,7 @@
 #include <stdint.h>
 
 #include "liblwgeom.h"
+#include "lwgeom_log.h"
 #include "../postgis_config.h"
 
 LWGEOM*
@@ -52,6 +53,11 @@ lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision)
     int res = 0;
     char shift = 0;
     do {
+      if (idx >= length) {
+        lwerror("lwgeom_from_encoded_polyline: input is truncated");
+        ptarray_free(pa);
+        return NULL;
+      }
       byte = encodedpolyline[idx++] - 63;
       res |= (byte & 0x1F) << shift;
       shift += 5;
@@ -62,6 +68,11 @@ lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision)
     shift = 0;
     res = 0;
     do {
+      if (idx >= length) {
+        lwerror("lwgeom_from_encoded_polyline: input is truncated");
+        ptarray_free(pa);
+        return NULL;
+      }
       byte = encodedpolyline[idx++] - 63;
       res |= (byte & 0x1F) << shift;
       shift += 5;

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

Summary of changes:
 NEWS                                     |  2 ++
 liblwgeom/cunit/cu_in_encoded_polyline.c |  8 ++++++++
 liblwgeom/lwin_encoded_polyline.c        | 11 +++++++++++
 3 files changed, 21 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list