cscope/cscope-15.7a-lexerr.patch
2011-06-29 12:13:29 -04:00

98 lines
3.3 KiB
Diff

diff -up cscope-15.7a/src/crossref.c.orig cscope-15.7a/src/crossref.c
--- cscope-15.7a/src/crossref.c.orig 2011-06-29 12:07:37.146099207 -0400
+++ cscope-15.7a/src/crossref.c 2011-06-29 12:04:38.416385875 -0400
@@ -45,7 +45,7 @@
#include <stdlib.h>
#include <sys/stat.h>
-static char const rcsid[] = "$Id: crossref.c,v 1.14 2006/07/23 20:59:20 broeker Exp $";
+static char const rcsid[] = "$Id: crossref.c,v 1.15 2009/08/28 14:28:27 nhorman Exp $";
/* convert long to a string */
@@ -176,6 +176,7 @@ crossref(char *srcfile)
#endif
break;
+ case LEXERR: /* Lexer error, abort further parsing of this file */
case LEXEOF: /* end of file; last line may not have \n */
/* if there were symbols, output them and the source line */
diff -up cscope-15.7a/src/fscanner.l.orig cscope-15.7a/src/fscanner.l
--- cscope-15.7a/src/fscanner.l.orig 2011-06-29 12:07:37.139099022 -0400
+++ cscope-15.7a/src/fscanner.l 2011-06-29 12:05:06.854135643 -0400
@@ -52,7 +52,7 @@
#define IFLEVELINC 5 /* #if nesting level size increment */
#define YY_NO_TOP_STATE 1
-static char const rcsid[] = "$Id: fscanner.l,v 1.13 2007/01/07 12:41:23 broeker Exp $";
+static char const rcsid[] = "$Id: fscanner.l,v 1.14 2009/08/28 14:28:27 nhorman Exp $";
int first; /* buffer index for first char of symbol */
int last; /* buffer index for last char of symbol */
@@ -341,6 +341,8 @@ wsnl [ \t\r\v\f\n]|{comment}
my_yymore();
s = strpbrk(my_yytext, "\"<");
+ if (!s)
+ return(LEXERR);
my_yytext[my_yyleng-1] = '\0';
incfile(s + 1, s);
my_yytext[my_yyleng-1] = remember;
@@ -401,6 +403,8 @@ wsnl [ \t\r\v\f\n]|{comment}
/* NOTREACHED */
}
= { /* if a global definition initializer */
+ if (!my_yytext)
+ return(LEXERR);
if (global == YES && ppdefine == NO && my_yytext[0] != '#') {
initializerbraces = braces;
initializer = YES;
@@ -409,6 +413,8 @@ wsnl [ \t\r\v\f\n]|{comment}
/* NOTREACHED */
}
: { /* a if global structure field */
+ if (!my_yytext)
+ return(LEXERR);
if (global == YES && ppdefine == NO && my_yytext[0] != '#') {
structfield = YES;
}
diff -up cscope-15.7a/src/scanner.h.orig cscope-15.7a/src/scanner.h
--- cscope-15.7a/src/scanner.h.orig 2011-06-29 12:07:37.128098733 -0400
+++ cscope-15.7a/src/scanner.h 2011-06-29 12:04:08.361593537 -0400
@@ -30,7 +30,7 @@
DAMAGE.
=========================================================================*/
-/* $Id: scanner.h,v 1.4 2005/01/31 16:50:33 broeker Exp $ */
+/* $Id: scanner.h,v 1.5 2009/08/28 14:28:27 nhorman Exp $ */
#ifndef CSCOPE_SCANNER_H
@@ -60,9 +60,10 @@
#define UNIONDEF 'u'
/* other scanner token types */
-#define LEXEOF 0
-#define IDENT 1
-#define NEWLINE 2
+#define LEXEOF 0
+#define LEXERR 1
+#define IDENT 2
+#define NEWLINE 3
/* scanner.l global data */
extern int first; /* buffer index for first char of symbol */
diff -up cscope-15.7a/src/scanner.l.orig cscope-15.7a/src/scanner.l
--- cscope-15.7a/src/scanner.l.orig 2011-06-29 12:07:37.132098837 -0400
+++ cscope-15.7a/src/scanner.l 2011-06-29 12:05:33.416836037 -0400
@@ -574,6 +574,8 @@ class{ws}+{identifier}({wsnl}|[a-zA-Z0-9
char *s;
s = strpbrk(yytext, "\"<");
+ if (!s)
+ return(LEXERR);
incfile(s + 1, s);
/* HBB: avoid pointer mismatch if yytext is
* unsigned, or a pointer */