From a2040cdc1fd14de76099ecee773585c8fc5abe75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Tue, 7 Jan 2014 10:52:52 +0100 Subject: [PATCH] Fixed overflow in yyerror Resolves: rhbz#1049167 --- graphviz-2.34.0-yyerror-overflow-fix.patch | 53 ++++++++++++++++++++++ graphviz.spec | 9 +++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 graphviz-2.34.0-yyerror-overflow-fix.patch diff --git a/graphviz-2.34.0-yyerror-overflow-fix.patch b/graphviz-2.34.0-yyerror-overflow-fix.patch new file mode 100644 index 0000000..f8bb983 --- /dev/null +++ b/graphviz-2.34.0-yyerror-overflow-fix.patch @@ -0,0 +1,53 @@ +From 7aaddf52cd98589fb0c3ab72a393f8411838438a Mon Sep 17 00:00:00 2001 +From: "Emden R. Gansner" +Date: Fri, 4 Oct 2013 09:06:39 -0400 +Subject: [PATCH] Fix buffer overflow problem when reporting a syntax error + with a very long input line + +--- + lib/cgraph/scan.l | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/lib/cgraph/scan.l b/lib/cgraph/scan.l +index 3cfde0f..2efd203 100644 +--- a/lib/cgraph/scan.l ++++ b/lib/cgraph/scan.l +@@ -16,6 +16,7 @@ + %{ + #include + #include ++#include + #include + #define GRAPH_EOF_TOKEN '@' /* lex class must be defined below */ + /* this is a workaround for linux flex */ +@@ -191,13 +192,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'\n",InputFile, line_num, +- str,line_num,yytext); +- else +- sprintf(buf," %s in line %d near '%s'\n", str,line_num,yytext); +- agerr(AGWARN,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"); ++ agerr(AGWARN,agxbuse(&xb)); ++ agxbfree(&xb); + } + /* must be here to see flex's macro defns */ + void aglexeof() { unput(GRAPH_EOF_TOKEN); } +-- +1.8.5.1 + diff --git a/graphviz.spec b/graphviz.spec index 24e6672..4cb1e83 100644 --- a/graphviz.spec +++ b/graphviz.spec @@ -52,7 +52,7 @@ Name: graphviz Summary: Graph Visualization Tools Version: 2.34.0 -Release: 6%{?dist} +Release: 7%{?dist} Group: Applications/Multimedia License: EPL URL: http://www.graphviz.org/ @@ -63,6 +63,8 @@ Patch1: graphviz-2.32.0-testsuite-sigsegv-fix.patch Patch2: graphviz-2.32.0-rtest-errout-fix.patch # Upstream bug 0002387 Patch3: graphviz-2.34.0-lefty-getaddrinfo.patch +# Fix yyerror overflow (#1049167) +Patch4: graphviz-2.34.0-yyerror-overflow-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: zlib-devel, libpng-devel, libjpeg-devel, expat-devel, freetype-devel >= 2 BuildRequires: ksh, bison, m4, flex, tk-devel, tcl-devel >= 8.3, swig @@ -268,6 +270,7 @@ Various tcl packages (extensions) for the graphviz tools. %patch1 -p1 -b .testsuite-sigsegv-fix %patch2 -p1 -b .rtest-errout-fix %patch3 -p1 -b .lefty-getaddrinfo +%patch4 -p1 -b .overflow-yyerror-fix # Attempt to fix rpmlint warnings about executable sources find -type f -regex '.*\.\(c\|h\)$' -exec chmod a-x {} ';' @@ -556,6 +559,10 @@ rm -rf %{buildroot} %changelog +* Tue Jan 7 2014 Jaroslav Škarvada - 2.34.0-7 +- Fixed overflow in yyerror + Resolves: rhbz#1049167 + * Sat Dec 28 2013 Peter Robinson 2.34.0-6 - Disable R bindings on aarch64 for the moment