Fixed crash in lexer on empty input stream.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 24 Feb 2009 02:04:05 -0500
changeset 697 765a85a989a2
parent 696 c9e03dc63eb8
child 698 a6cd16b3e270
Fixed crash in lexer on empty input stream.
mojoshader_lexer.c
mojoshader_lexer.re
--- a/mojoshader_lexer.c	Tue Feb 24 01:53:24 2009 -0500
+++ b/mojoshader_lexer.c	Tue Feb 24 02:04:05 2009 -0500
@@ -1245,7 +1245,11 @@
 		}
 	}
 yy206:
-	{ cursor=(const uchar*)s->source; goto scanner_loop; }
+	{
+                            token = cursor = (const uchar *) s->source;
+                            limit = cursor + s->bytes_left;
+                            goto scanner_loop;
+                        }
 yy207:
 	++YYCURSOR;
 	yych = *YYCURSOR;
--- a/mojoshader_lexer.re	Tue Feb 24 01:53:24 2009 -0500
+++ b/mojoshader_lexer.re	Tue Feb 24 02:04:05 2009 -0500
@@ -212,7 +212,12 @@
         PP "endif"      { RET(TOKEN_PP_ENDIF); }
         PP "error"      { RET(TOKEN_PP_ERROR); }
         WHITESPACE      { goto ppdirective; }
-        ANY             { cursor=(const uchar*)s->source; goto scanner_loop; }
+
+        ANY             {
+                            token = cursor = (const uchar *) s->source;
+                            limit = cursor + s->bytes_left;
+                            goto scanner_loop;
+                        }
 */
 
 bad_chars: