Ingesting a NUL or trying to allocate an empty identifier are both
invalid conditions.
---
 src/compiler/scanner.re |    4 +++-
 src/compiler/unique.c   |    2 ++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/compiler/scanner.re b/src/compiler/scanner.re
index f2a6313..d39bf2a 100644
--- a/src/compiler/scanner.re
+++ b/src/compiler/scanner.re
@@ -79,6 +79,8 @@ int scan(struct scanner *s)
        s->old_cursor = s->cursor;
 
        /*!re2c
+               <*>[\x00]               { abort(); }
+
                <*>[\x20\r\t]           { goto std; }
                <*>"\n"                 { s->lineno++;
                                          YYSETCONDITION(yycN);
@@ -142,7 +144,7 @@ int scan(struct scanner *s)
                <FNAME2>[^ \x00\n\r\t]|[^ \x00\n\r\t][^\n\x00]*[^ \x00\n\r\t]
                                        { return TOK_FNAME; }
 
-               <*>[\x00-\xff]          { return TOK_ERROR; }
+               <*>[\x01-\xff]          { return TOK_ERROR; }
        */
 }
 
diff --git a/src/compiler/unique.c b/src/compiler/unique.c
index 7804dcd..6f4cd05 100644
--- a/src/compiler/unique.c
+++ b/src/compiler/unique.c
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <assert.h>
 
 #include "unique.h"
 
@@ -124,6 +125,7 @@ const char *unique_n(const char *s, int n)
        const char **res;
        const char **walk;
 
+       assert(n);
        if(!isid(*s))
                return s;
        res = bsearch(&key, well_known, sizeof(well_known)/sizeof(*well_known),
-- 
1.7.1

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to