commit 01fe01d3015feb37351e6f79a1133bafd2df712c
Author: Mamoru TASAKA <mtasaka(a)fedoraproject.org>
Date: Sat Nov 7 23:22:56 2020 +0900
Another FORTIFY_SOURCE issue patch, this time with LTO (#5790)
zsnes-1.51-FORTIFY_SOURCE_3.patch | 32 ++++++++++++++++++++++++++++++++
zsnes.spec | 13 ++++++++++++-
2 files changed, 44 insertions(+), 1 deletion(-)
---
diff --git a/zsnes-1.51-FORTIFY_SOURCE_3.patch b/zsnes-1.51-FORTIFY_SOURCE_3.patch
new file mode 100644
index 0000000..d888b4a
--- /dev/null
+++ b/zsnes-1.51-FORTIFY_SOURCE_3.patch
@@ -0,0 +1,32 @@
+From 747bc1c34fee9b3e4c62a7bde177cb48bf20b97e Mon Sep 17 00:00:00 2001
+From: Mamoru TASAKA <mtasaka(a)fedoraproject.org>
+Date: Sat, 10 Oct 2020 15:14:56 +0900
+Subject: [PATCH] Unspecify the size of SPCRAM in debugger.c to make
+ _FORTIFY_SOURCE and LTO happy
+
+https://bugzilla.rpmfusion.org/show_bug.cgi?id=5790
+
+With LTO (link-time optimization), again the compiler thinks the size of SPCRAM is
+65472 (as written in debugger.c), so with _FORTIFY_SOURCE, glibc thinks again
+buffer overrun occured as written on
+https://bugzilla.rpmfusion.org/show_bug.cgi?id=5651
+---
+ src/debugger.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/debugger.c b/src/debugger.c
+index 30997c8..98ea799 100644
+--- a/src/debugger.c
++++ b/src/debugger.c
+@@ -36,7 +36,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ // All of these should be in headers, people!
+
+-extern unsigned char oamram[1024], SPCRAM[65472], DSPMem[256];
++extern unsigned char oamram[1024], SPCRAM[], DSPMem[256];
+
+ extern unsigned char curblank;
+ extern unsigned char curcyc;
+--
+2.28.0
+
diff --git a/zsnes.spec b/zsnes.spec
index 3d7ab68..3a25a22 100644
--- a/zsnes.spec
+++ b/zsnes.spec
@@ -4,7 +4,7 @@
Summary: A Super Nintendo emulator
Name: zsnes
Version: 1.51
-Release: 29%{?dist}
+Release: 30%{?dist}
License: GPLv2
URL:
http://www.zsnes.com/
Source:
http://dl.sf.net/%{name}/%{name}%{pkgversion}src.tar.bz2
@@ -39,6 +39,8 @@ Patch11: zsnes-1.51-gcc10.patch
# Mamoru TASAKA
#
https://bugzilla.rpmfusion.org/show_bug.cgi?id=5651
Patch12: zsnes-1.51-FORTIFY_SOURCE_2.patch
+# Again FORTIFY_SOURCE, this time with LTO
+Patch13: zsnes-1.51-FORTIFY_SOURCE_3.patch
# This is to build only for ix86 on plague
#ExclusiveArch: %{ix86}
@@ -79,6 +81,7 @@ and to save the game state, even network play is possible.
%patch10 -p0
%patch11 -p1
%patch12 -p2
+%patch13 -p2
# Remove hardcoded CFLAGS and LDFLAGS
sed -i \
@@ -87,6 +90,11 @@ sed -i \
-e '/^\s*LDFLAGS=.* -L\/usr\/local\/lib /d' \
configure.in
+# Enable debug information for nasm
+sed -i \
+ -e '\@^NFLAGS=@s|\$NFLAGS |\$NFLAGS -g |' \
+ configure.in
+
# Fix line encodings in docs/readme.txt/*
sed -i 's/\r//' ../docs/readme.txt/*.txt
@@ -145,6 +153,9 @@ done
%changelog
+* Sat Nov 7 2020 Mamoru TASAKA <mtasaka(a)fedoraproject.org> - 1.51-30
+- Another FORTIFY_SOURCE issue patch, this time with LTO (#5790)
+
* Wed Aug 19 2020 RPM Fusion Release Engineering <leigh123linux(a)gmail.com> -
1.51-29
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild