[SCM] PostGIS branch master updated. 3.5.0-391-g0f4a868ef

git at osgeo.org git at osgeo.org
Wed Jun 11 07:11:42 PDT 2025


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  0f4a868ef891e6211510e2e3b39a7d6ca882f063 (commit)
      from  c932604514651d454543b66fdb18055fd5ae40a2 (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 0f4a868ef891e6211510e2e3b39a7d6ca882f063
Author: Maksim Korotkov <m.korotkov at postgrespro.ru>
Date:   Tue Jun 10 11:21:33 2025 +0300

    replace input arguments check for avoiding null dereference
    
    Signed-off-by: Maksim Korotkov <m.korotkov at postgrespro.ru>

diff --git a/liblwgeom/gserialized2.c b/liblwgeom/gserialized2.c
index 8829e60db..5c40615f5 100644
--- a/liblwgeom/gserialized2.c
+++ b/liblwgeom/gserialized2.c
@@ -294,16 +294,16 @@ gserialized2_hash(const GSERIALIZED *g1)
 
 const float * gserialized2_get_float_box_p(const GSERIALIZED *g, size_t *ndims)
 {
+	/* Cannot do anything if there's no box */
+	if (!(g && gserialized_has_bbox(g)))
+		return NULL;
+
 	uint8_t *ptr = (uint8_t*)(g->data);
 	size_t bndims = G2FLAGS_NDIMS_BOX(g->gflags);
 
 	if (ndims)
 		*ndims = bndims;
 
-	/* Cannot do anything if there's no box */
-	if (!(g && gserialized_has_bbox(g)))
-		return NULL;
-
 	/* Advance past optional extended flags */
 	if (gserialized2_has_extended(g))
 		ptr += 8;
@@ -313,10 +313,11 @@ const float * gserialized2_get_float_box_p(const GSERIALIZED *g, size_t *ndims)
 
 int gserialized2_read_gbox_p(const GSERIALIZED *g, GBOX *gbox)
 {
-	uint8_t gflags = g->gflags;
 	/* Null input! */
 	if (!(g && gbox)) return LW_FAILURE;
 
+	uint8_t gflags = g->gflags;
+
 	/* Initialize the flags on the box */
 	gbox->flags = gserialized2_get_lwflags(g);
 

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

Summary of changes:
 liblwgeom/gserialized2.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list