Fix crash when configuration file is not EOL-terminated.

This commit is contained in:
Matthias Andree 2015-01-19 20:36:42 +00:00
parent 0dff9e6c89
commit 9d0ba19501
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=377474

View file

@ -0,0 +1,22 @@
--- src/TRConfigLexer.re.orig 2012-03-03 19:17:45 UTC
+++ src/TRConfigLexer.re
@@ -72,7 +72,7 @@
#define SC(cond) LEXER_SC_ ## cond: LEXER_SC_ ## cond
/* Check for end-of-input */
-#define CHECK_EOI() if (_eoi) { return NULL; }
+#define CHECK_EOI() if (_cursor >= _limit) { return NULL; }
/* Skip a token */
#define SKIP(cond) CHECK_EOI(); goto LEXER_SC_ ## cond
@@ -115,10 +115,6 @@
- (void) fill: (int) length {
/* We just need to prevent re2c from walking off the end of our buffer */
assert(_limit - _cursor >= 0);
- if (_cursor == _limit) {
- /* Save the cursor and signal EOI */
- _eoi = _cursor;
- }
}
- (TRConfigToken *) scan {