]> granicus.if.org Git - postgis/commitdiff
Fix memory corruption in case where lexer is interrupted mid-process
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 26 Feb 2018 20:03:28 +0000 (20:03 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 26 Feb 2018 20:03:28 +0000 (20:03 +0000)
References #4017
For 2.4 branch

git-svn-id: http://svn.osgeo.org/postgis/branches/2.4@16424 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
liblwgeom/lwin_wkt_lex.l

diff --git a/NEWS b/NEWS
index 81ae21081788cf33a8516becdc20062bde9433a3..b03cdbda9c7140ab637d103a5de340bc2aa2bebb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ PostGIS 2.4.4dev
   - #3942, geojson: Do not include private header for json-c >= 0.13
            (Björn Esser)
   - #4025, Incorrect answers for temporally "amost overlapping" ranges
+  - #4017, lwgeom lexer memory corruption (Peter E)
 
  * Enhancements *
     - #3992, Use PKG_PROG_PKG_CONFIG macro from pkg.m4 to detect pkg-config
index 188b5a02208cf77432eefc2a00c17faf05db430a..27e90d49352225615d83e661cc262f83d6323618 100644 (file)
 
 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.
 */
@@ -38,7 +21,6 @@ static void wkt_lexer_unknown()
        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_yyrealloc  (void * ptr, yy_size_t  size )
 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); 
+} 
+