diff --git a/foma-fix-sizeof.patch b/foma-fix-sizeof.patch new file mode 100644 index 0000000..004585b --- /dev/null +++ b/foma-fix-sizeof.patch @@ -0,0 +1,16 @@ +https://bugzilla.opensuse.org/show_bug.cgi?id=1109949 +https://github.com/mhulden/foma/pull/78 + +Index: foma-0.9.18+git20170507.07bb944/foma/rewrite.c +=================================================================== +--- foma-0.9.18+git20170507.07bb944.orig/foma/rewrite.c ++++ foma-0.9.18+git20170507.07bb944/foma/rewrite.c +@@ -103,7 +103,7 @@ struct fsm *fsm_rewrite(struct rewrite_s + rb = xxcalloc(1, sizeof(struct rewrite_batch)); + rb->rewrite_set = all_rules; + rb->num_rules = num_rules; +- rb->namestrings = xxmalloc(sizeof rb->namestrings * num_rules); ++ rb->namestrings = xxmalloc(sizeof *rb->namestrings * num_rules); + for (i = 0; i < rb->num_rules; i++) { + sprintf(rb->namestrings[i], "@#%04i@", i+1); + } diff --git a/foma.changes b/foma.changes index 82460d0..d0345fb 100644 --- a/foma.changes +++ b/foma.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Sep 27 09:00:24 UTC 2018 - Bernhard Wiedemann + +- Add foma-fix-sizeof.patch to fix segfault on 32-bit (boo#1109949) + ------------------------------------------------------------------- Thu Sep 27 07:28:30 UTC 2018 - Tomáš Chvátal diff --git a/foma.spec b/foma.spec index a64ec8e..46ad026 100644 --- a/foma.spec +++ b/foma.spec @@ -27,6 +27,7 @@ URL: https://fomafst.github.io/ # Source must be from git tarball has different license than git, no idea why Source0: foma-%{version}.tar.xz Patch0: foma-harden-build.patch +Patch1: foma-fix-sizeof.patch BuildRequires: bison BuildRequires: flex BuildRequires: ncurses-devel @@ -64,6 +65,7 @@ Finite-state C library development files and headers for %{name}. %prep %setup -q -n %{name}-%{version}/%{name} %patch0 -p2 +%patch1 -p2 sed -i '/^CFLAGS/c\CFLAGS = %{optflags} -Wl,--as-needed -D_GNU_SOURCE -std=c99 -fvisibility=hidden -fPIC' Makefile sed -i '/^LDFLAGS/c\LDFLAGS = -lreadline -lz -lreadline -fpic' Makefile sed -i '/^FLOOKUPLDFLAGS/c\FLOOKUPLDFLAGS = libfoma.a -lz -fpic' Makefile