From c07b9720465ef9c5600eafd69294af092f537a1a Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 14 Feb 2005 09:27:35 +0000 Subject: [PATCH] Fix memory corruption in genmacro. If the string is empty, don't start screwing with stuff at str[strlen(str)-1]. --- yasm-0.4.0-genmacro.patch | 13 +++++++++++++ yasm.spec | 8 ++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 yasm-0.4.0-genmacro.patch diff --git a/yasm-0.4.0-genmacro.patch b/yasm-0.4.0-genmacro.patch new file mode 100644 index 0000000..113f399 --- /dev/null +++ b/yasm-0.4.0-genmacro.patch @@ -0,0 +1,13 @@ +--- yasm-0.4.0/modules/preprocs/nasm/genmacro.c~ 2004-10-31 03:55:54.000000000 +0000 ++++ yasm-0.4.0/modules/preprocs/nasm/genmacro.c 2005-02-14 09:21:37.000000000 +0000 +@@ -102,8 +102,8 @@ + while (*strp == ' ' || *strp == '\t') + strp++; + len = strlen(strp); +- while (strp[len-1] == ' ' || strp[len-1] == '\t' || +- strp[len-1] == '\n') { ++ while (len && (strp[len-1] == ' ' || strp[len-1] == '\t' || ++ strp[len-1] == '\n')) { + strp[len-1] = '\0'; + len--; + } diff --git a/yasm.spec b/yasm.spec index f3834eb..cad9bba 100644 --- a/yasm.spec +++ b/yasm.spec @@ -1,11 +1,12 @@ Summary: Complete rewrite of the NASM assembler Name: yasm Version: 0.4.0 -Release: 1 +Release: 2 License: BSD Group: Development/Languages URL: http://www.tortall.net/projects/yasm/ Source: http://www.tortall.net/projects/yasm/releases/yasm-%{version}.tar.gz +Patch0: yasm-0.4.0-genmacro.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: bison, byacc, xmlto, gettext-devel @@ -36,7 +37,7 @@ Install this package if you need to rebuild applications that use yasm. %prep %setup - +%patch0 -p1 %build %configure @@ -82,6 +83,9 @@ Install this package if you need to rebuild applications that use yasm. %changelog +* Mon Feb 14 2005 David Woodhouse 0.4.0-2 +- Fix corruption in genmacro + * Fri Jan 28 2005 Matthias Saou 0.4.0-1 - Initial RPM release.