]> 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:14:36 +0000 (20:14 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 26 Feb 2018 20:14:36 +0000 (20:14 +0000)
References #4017
For 2.3

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

NEWS
liblwgeom/lwin_wkt_lex.l

diff --git a/NEWS b/NEWS
index 0999fd008b09b98caba42386a1e55d6787ce84eb..2f5cfa2897d621e1d59b49f8806d7337263c7373 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ PostGIS 2.3.7dev
   - #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
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); 
+} 
+