]> 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 19:51:25 +0000 (19:51 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 26 Feb 2018 19:51:25 +0000 (19:51 +0000)
References #4017

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

liblwgeom/lwin_wkt_lex.l

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); 
+} 
+