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

Paul Ramsey pramsey at cleverelephant.ca
Mon Feb 26 11:51:25 PST 2018


Author: pramsey
Date: 2018-02-26 11:51:25 -0800 (Mon, 26 Feb 2018)
New Revision: 16422

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


Modified: trunk/liblwgeom/lwin_wkt_lex.l
===================================================================
--- trunk/liblwgeom/lwin_wkt_lex.l	2018-02-26 18:27:03 UTC (rev 16421)
+++ trunk/liblwgeom/lwin_wkt_lex.l	2018-02-26 19:51:25 UTC (rev 16422)
@@ -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