[postgis-tickets] r15798 - Fix crash on larger geometries, caused by direct freeing

Paul Ramsey pramsey at cleverelephant.ca
Fri Sep 22 12:55:39 PDT 2017


Author: pramsey
Date: 2017-09-22 12:55:39 -0700 (Fri, 22 Sep 2017)
New Revision: 15798

Modified:
   trunk/liblwgeom/bytebuffer.c
   trunk/liblwgeom/lwout_twkb.c
Log:
Fix crash on larger geometries, caused by direct freeing 
of bytebuffer internals


Modified: trunk/liblwgeom/bytebuffer.c
===================================================================
--- trunk/liblwgeom/bytebuffer.c	2017-09-22 19:06:58 UTC (rev 15797)
+++ trunk/liblwgeom/bytebuffer.c	2017-09-22 19:55:39 UTC (rev 15798)
@@ -104,7 +104,10 @@
 bytebuffer_destroy_buffer(bytebuffer_t *s)
 {
 	if ( s->buf_start != s->buf_static )
+	{
 		lwfree(s->buf_start);
+		s->buf_start = NULL;
+	}
 
 	return;
 }

Modified: trunk/liblwgeom/lwout_twkb.c
===================================================================
--- trunk/liblwgeom/lwout_twkb.c	2017-09-22 19:06:58 UTC (rev 15797)
+++ trunk/liblwgeom/lwout_twkb.c	2017-09-22 19:55:39 UTC (rev 15798)
@@ -211,7 +211,7 @@
 		bytebuffer_append_bytebuffer(ts->geom_buf, b_p);
 
 		/* Clear our temporary buffer */
-		lwfree(b.buf_start);
+		bytebuffer_destroy_buffer(&b);
 	}
 	else
 	{



More information about the postgis-tickets mailing list