Fixed overflow in yyerror

Resolves: rhbz#1049168
- Fixed malformed php5 patch due to distgit conversion
This commit is contained in:
Jaroslav Škarvada 2014-01-07 14:07:56 +01:00
parent 6d9aae5147
commit 463d336550
3 changed files with 73 additions and 3 deletions

View File

@ -0,0 +1,63 @@
diff -up graphviz-2.12/lib/agraph/Makefile.am.origy graphviz-2.12/lib/agraph/Makefile.am
--- graphviz-2.12/lib/agraph/Makefile.am.origy 2006-09-26 18:47:54.000000000 +0200
+++ graphviz-2.12/lib/agraph/Makefile.am 2014-01-07 13:59:14.868361095 +0100
@@ -6,7 +6,8 @@ pkgconfigdir = $(libdir)/pkgconfig
AM_CPPFLAGS = \
-I$(top_srcdir) \
- -I$(top_srcdir)/lib/cdt
+ -I$(top_srcdir)/lib/cdt \
+ -I$(top_srcdir)/lib/graph
pkginclude_HEADERS = aghdr.h agraph.h malloc.h vmstub.h grammar.h
noinst_LTLIBRARIES = libagraph_C.la
@@ -22,7 +23,8 @@ libagraph_C_la_SOURCES = agerror.c apply
libagraph_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined
libagraph_la_SOURCES = $(libagraph_C_la_SOURCES)
-libagraph_la_LIBADD = $(top_builddir)/lib/cdt/libcdt.la
+libagraph_la_LIBADD = $(top_builddir)/lib/cdt/libcdt.la \
+ $(top_builddir)/lib/graph/libgraph.la
scan.o scan.lo: scan.c grammar.h
diff --git a/lib/agraph/scan.l b/lib/agraph/scan.l
index b3c4875..a46cd92 100644
--- a/lib/agraph/scan.l
+++ b/lib/agraph/scan.l
@@ -20,6 +20,7 @@
#include <ctype.h>
#include "grammar.h"
#include "aghdr.h"
+#include "agxbuf.h"
#ifdef WIN32
#include <io.h>
#endif
@@ -153,13 +154,21 @@ ID ({NAME}|{NUMBER})
%%
void yyerror(char *str)
{
+ unsigned char xbuf[BUFSIZ];
char buf[BUFSIZ];
- if (InputFile)
- sprintf(buf,"%s:%d: %s in line %d near '%s'",InputFile, line_num,
- str,line_num,yytext);
- else
- sprintf(buf," %s in line %d near '%s'", str,line_num,yytext);
- agerror(AGERROR_SYNTAX,buf);
+ agxbuf xb;
+
+ agxbinit(&xb, BUFSIZ, xbuf);
+ if (InputFile) {
+ agxbput (&xb, InputFile);
+ agxbput (&xb, ": ");
+ }
+ sprintf(buf," %s in line %d near '", str,line_num);
+ agxbput (&xb, buf);
+ agxbput (&xb, yytext);
+ agxbput (&xb,"'\n");
+ agerror(AGERROR_SYNTAX,agxbuse(&xb));
+ agxbfree(&xb);
}
/* must be here to see flex's macro defns */
void aglexeof() { unput(GRAPH_EOF_TOKEN); }

View File

@ -14,8 +14,8 @@ diff -urN graphviz-2.12/configure.ac graphviz-2.12-patched/configure.ac
--- graphviz-2.12/configure.ac 2006-12-04 15:11:58.000000000 -0600
+++ graphviz-2.12-patched/configure.ac 2006-12-08 08:07:10.000000000 -0600
@@ -1,4 +1,4 @@
-# $Id: graphviz-php5.patch,v 1.1 2007/05/24 17:05:14 jima Exp $ $Revision: 1.1 $
+# $Id: graphviz-php5.patch,v 1.1 2007/05/24 17:05:14 jima Exp $ $Revision: 1.1 $
-# $Id: configure.ac,v 1.168 2006/12/04 21:11:58 erg Exp $ $Revision: 1.168 $
+# $Id: configure.ac,v 1.170 2006/12/07 17:25:53 ellson Exp $ $Revision: 1.170 $
# Process this file with autoconf to produce a configure script
AC_PREREQ(2.54)

View File

@ -7,13 +7,14 @@
#-- graphviz src.rpm --------------------------------------------------------
Name: graphviz
Version: 2.12
Release: 8%{?dist}
Release: 9%{?dist}
License: CPL
URL: http://www.graphviz.org/
Source: http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.12.tar.gz
Patch0: %{name}-php5.patch
Patch1: %{name}-libcdt.patch
Patch2: graphviz-2.12-yyerror-overflow-fix.patch
# graphviz is relocatable
#Prefix: /usr
@ -408,6 +409,7 @@ Provides some additional PDF and HTML documentation for graphviz.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
# XXX ix86 only used to have -ffast-math, let's use everywhere
@ -444,6 +446,11 @@ rm -rf $RPM_BUILD_ROOT
#-- changelog --------------------------------------------------
%changelog
* Tue Jan 7 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 2.12-9
- Fixed overflow in yyerror
Resolves: rhbz#1049168
- Fixed malformed php5 patch due to distgit conversion
* Thu May 24 2007 Patrick "Jima" Laughton <jima@beer.tclug.org> 2.12-8
- Pulled spec from devel/
- Adapted spec to build for EL-5 (thanks to Christopher Stone)