Resolves: bz 717545

This commit is contained in:
Neil Horman 2011-06-29 12:13:29 -04:00
parent 9f6b96643c
commit 099b3dad49
2 changed files with 103 additions and 1 deletions

97
cscope-15.7a-lexerr.patch Normal file
View File

@ -0,0 +1,97 @@
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 */

View File

@ -1,7 +1,7 @@
Summary: C source code tree search and browse tool Summary: C source code tree search and browse tool
Name: cscope Name: cscope
Version: 15.7a Version: 15.7a
Release: 6%{?dist} Release: 7%{?dist}
Source0: http://unc.dl.sourceforge.net/sourceforge/cscope/cscope-15.7a.tar.bz2 Source0: http://unc.dl.sourceforge.net/sourceforge/cscope/cscope-15.7a.tar.bz2
URL: http://cscope.sourceforge.net URL: http://cscope.sourceforge.net
License: BSD and GPLv2+ License: BSD and GPLv2+
@ -20,6 +20,7 @@ Patch1:cscope-15.6-ocs.patch
Patch2:cscope-15.6-xcscope-man.patch Patch2:cscope-15.6-xcscope-man.patch
Patch3:cscope-15.7-sig_pipe.patch Patch3:cscope-15.7-sig_pipe.patch
Patch4:cscope-15.7a-add-cctree.patch Patch4:cscope-15.7a-add-cctree.patch
Patch5:cscope-15.7a-lexerr.patch
%description %description
cscope is a mature, ncurses based, C source code tree browsing tool. It cscope is a mature, ncurses based, C source code tree browsing tool. It
@ -35,6 +36,7 @@ matches for use in file editing.
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1
%build %build
%configure %configure
@ -91,6 +93,9 @@ rm -f %{emacs_lisp_path}/xcscope.el
rm -f %{vim_plugin_path}/cctree.vim rm -f %{vim_plugin_path}/cctree.vim
%changelog %changelog
* Wed Jun 30 2011 Neil Horman <nhorman@redhat.com> - 15.7a-7
- Added LEXERR token to catch bad parsing before we crash (bz717545)
* Fri Jun 24 2011 Neil Horman <nhorman@redhat.com> - 15.7a-6 * Fri Jun 24 2011 Neil Horman <nhorman@redhat.com> - 15.7a-6
- Fixed licensing for xcscope.el (bz 715898) - Fixed licensing for xcscope.el (bz 715898)
- Fixed xemacs pkg. dependency (bz 719523) - Fixed xemacs pkg. dependency (bz 719523)