[postgis-tickets] r16428 - Fix memory corruption in case where lexer is interrupted mid-process

Paul Ramsey pramsey at cleverelephant.ca
Mon Feb 26 12:16:09 PST 2018


Author: pramsey
Date: 2018-02-26 12:16:08 -0800 (Mon, 26 Feb 2018)
New Revision: 16428

Modified:
   branches/2.2/NEWS
   branches/2.2/liblwgeom/lwin_wkt_lex.l
Log:
Fix memory corruption in case where lexer is interrupted mid-process
References #4017
For 2.2


Modified: branches/2.2/NEWS
===================================================================
--- branches/2.2/NEWS	2018-02-26 20:14:56 UTC (rev 16427)
+++ branches/2.2/NEWS	2018-02-26 20:16:08 UTC (rev 16428)
@@ -5,6 +5,7 @@
   - #3965, ST_ClusterKMeans used to lose some clusters on initialization
            (Darafei Praliaskouski)
   - #3978, Fix KNN when upgrading from 2.1 or older (Sandro Santilli)
+  - #4017, lwgeom lexer memory corruption (Peter E)
 
 
 PostGIS 2.2.6

Modified: branches/2.2/liblwgeom/lwin_wkt_lex.l
===================================================================
--- branches/2.2/liblwgeom/lwin_wkt_lex.l	2018-02-26 20:14:56 UTC (rev 16427)
+++ branches/2.2/liblwgeom/lwin_wkt_lex.l	2018-02-26 20:16:08 UTC (rev 16428)
@@ -10,24 +10,7 @@
 
 static YY_BUFFER_STATE wkt_yy_buf_state; 
 
-
 /*
-* Set up the lexer!
-*/
-void wkt_lexer_init(char *src) 
-{ 
-	wkt_yy_buf_state = wkt_yy_scan_string(src); 
-} 
-
-/*
-* Clean up the lexer!
-*/
-void wkt_lexer_close() 
-{ 
-	wkt_yy_delete_buffer(wkt_yy_buf_state); 
-} 
-
-/*
 * Handle errors due to unexpected junk in WKT strings.
 */
 static void wkt_lexer_unknown() 
@@ -38,7 +21,6 @@
 	global_parser_result.errlocation = wkt_yylloc.last_column;
 }
 
-
 /* 
 * This macro is magically run after a rule is found but before the main 
 * action is run. We use it to update the parse location information
@@ -129,4 +111,21 @@
 void wkt_yyfree (void * ptr )
 {
 	lwfree( (char *) ptr );	/* see wkt_yyrealloc() for (char *) cast */
-}
\ No newline at end of file
+}
+
+/*
+* Set up the lexer!
+*/
+void wkt_lexer_init(char *src) 
+{ 
+	wkt_yy_buf_state = wkt_yy_scan_string(src); 
+} 
+
+/*
+* Clean up the lexer!
+*/
+void wkt_lexer_close() 
+{ 
+	wkt_yy_delete_buffer(wkt_yy_buf_state); 
+} 
+



More information about the postgis-tickets mailing list