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

Paul Ramsey pramsey at cleverelephant.ca
Mon Feb 26 12:14:36 PST 2018


Author: pramsey
Date: 2018-02-26 12:14:36 -0800 (Mon, 26 Feb 2018)
New Revision: 16426

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


Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS	2018-02-26 20:04:33 UTC (rev 16425)
+++ branches/2.3/NEWS	2018-02-26 20:14:36 UTC (rev 16426)
@@ -8,7 +8,9 @@
   - #4020, Casting from box3d to geometry now returns correctly connected
            PolyhedralSurface (Matthias Bay)
   - #4025, Incorrect answers for temporally "amost overlapping" ranges
+  - #4017, lwgeom lexer memory corruption (Peter E)
 
+
 PostGIS 2.3.6
 2018/01/17
 

Modified: branches/2.3/liblwgeom/lwin_wkt_lex.l
===================================================================
--- branches/2.3/liblwgeom/lwin_wkt_lex.l	2018-02-26 20:04:33 UTC (rev 16425)
+++ branches/2.3/liblwgeom/lwin_wkt_lex.l	2018-02-26 20:14:36 UTC (rev 16426)
@@ -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