SHA256
1
0
forked from pool/deutex

- Add 0001-increase-array-size-for-char-tname-variable-51.patch,

0001-Fix-strict-aliasing-violations.patch

OBS-URL: https://build.opensuse.org/package/show/games:tools/deutex?expand=0&rev=4
This commit is contained in:
Jan Engelhardt 2018-01-01 19:21:51 +00:00 committed by Git OBS Bridge
parent 5fb04e6c8f
commit 01054533a4
6 changed files with 212 additions and 82 deletions

View File

@ -0,0 +1,98 @@
From 8531292e3e13f713188187e21565b81669c9e0c7 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Mon, 1 Jan 2018 20:18:38 +0100
Subject: [PATCH] Fix strict aliasing violations
Type-punning causes unaligned pointers, and those cause crashes on
some processors, e.g. sparc64.
deutex.c: In function 'COMhelp':
deutex.c:1130:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
width1 = *((short *) &d->exec) + OPTINDENT;
deutex.c:1131:13: warning:
width2 = *((short *) &d->use);
deutex.c: In function 'opt_widths':
deutex.c:1236:17: warning:
*((short *) &current_section->com) = (short) width2r;
deutex.c:1237:17: warning:
if (*((short *) &current_section->com) != width2r)
deutex.c:1239:21: warning:
*((short *) &current_section->com) = SHRT_MAX;
deutex.c:1241:17: warning:
*((short *) &current_section->exec) = (short) width1t;
deutex.c:1242:17: warning:
if (*((short *) &current_section->exec) != width1t)
deutex.c:1244:21: warning:
*((short *) &current_section->exec) = SHRT_MAX;
deutex.c:1246:17: warning:
*((short *) &current_section->use) = (short) width2t;
deutex.c:1247:17: warning:
if (*((short *) &current_section->use) != width2t)
deutex.c:1249:21: warning:
*((short *) &current_section->use) = SHRT_MAX;
---
src/deutex.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/deutex.c b/src/deutex.c
index 15ff8c3..f52608c 100644
--- a/src/deutex.c
+++ b/src/deutex.c
@@ -1124,11 +1124,14 @@ void COMhelp(int argc, const char *argv[])
/* Do a first pass on all the options for this section. Find out how
wide the left and right columns need to be. */
if (d->type == SEC) {
+ uint16_t tmp;
if (section++)
putchar('\n');
printf("%s:\n", d->help);
- width1 = *((short *) &d->exec) + OPTINDENT;
- width2 = *((short *) &d->use);
+ memcpy(&tmp, &d->exec, sizeof(tmp));
+ width1 = tmp + OPTINDENT;
+ memcpy(&tmp, &d->use, sizeof(tmp));
+ width2 = tmp;
if (width1 + 1 + width2 > TTYCOL)
width1 = TTYCOL - width2 - COLSPACING;
}
@@ -1229,24 +1232,26 @@ static void opt_widths()
- exec = maximum text width of the first column,
- use = maximum text width of second column. */
if (current_section != NULL) {
+ uint16_t tmp;
current_section->argc = (char) width1r;
if (current_section->argc != width1r)
current_section->argc = CHAR_MAX; /* Can't happen */
- *((short *) &current_section->com) = (short) width2r;
- if (*((short *) &current_section->com) != width2r)
+ tmp = width2r;
+ if (tmp != width2r)
/* Can't happen */
- *((short *) &current_section->com) = SHRT_MAX;
+ tmp = SHRT_MAX;
+ memcpy(&current_section->com, &tmp, sizeof(tmp));
- *((short *) &current_section->exec) = (short) width1t;
- if (*((short *) &current_section->exec) != width1t)
- /* Can't happen */
- *((short *) &current_section->exec) = SHRT_MAX;
+ tmp = width1t;
+ if (tmp != width1t)
+ tmp = SHRT_MAX;
+ memcpy(&current_section->exec, &tmp, sizeof(tmp));
- *((short *) &current_section->use) = (short) width2t;
- if (*((short *) &current_section->use) != width2t)
- /* Can't happen */
- *((short *) &current_section->use) = SHRT_MAX;
+ tmp = width2t;
+ if (tmp != width2t)
+ tmp = SHRT_MAX;
+ memcpy(&current_section->use, &tmp, sizeof(tmp));
}
}
--
2.15.1

View File

@ -0,0 +1,30 @@
From 7024dd74a33780ef2dbdf614f4e52526cc3ab457 Mon Sep 17 00:00:00 2001
From: Fabian Greffrath <fabian@greffrath.com>
Date: Mon, 18 Dec 2017 02:12:37 +0100
Subject: [PATCH] increase array size for char "tname" variable (#51)
In src/texture.c:466 the "t" variable is of type signed short, so the
theoretically lowest possible value is -32768, which takes 6 digits.
The "TEX" string literal takes another 3 digits, so together with the
'\0' string delimiter byte we need an array size of 10 bytes for the
"tname" variable to be able to store the full maximum length string.
---
src/texture.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/texture.c b/src/texture.c
index 86c2396..3771c24 100644
--- a/src/texture.c
+++ b/src/texture.c
@@ -393,7 +393,7 @@ void TXUreadTEXTURE(const char *texture1_name, const char *Data,
int16_t Xofs, Yofs, Pindex; /* x,y coordinate in texture space */
/* patch name index in PNAMES table */
int32_t MaxPindex;
- static char tname[8]; /*texture name */
+ static char tname[10]; /*texture name */
static char pname[8]; /*patch name */
size_t header_size = 0;
size_t item_size = 0;
--
2.15.1

View File

@ -1,13 +1,14 @@
From 4a59997a18cb1c5269b05ef3f7a2fcd3ba2f7552 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de> From: Jan Engelhardt <jengelh@inai.de>
Date: 2017-07-07 16:45:59.059496819 +0200 Date: Mon, 1 Jan 2018 19:34:40 +0100
Subject: [PATCH] Drop limit of 4096 lumps
Permit reading of WADs with more than 4096 entries.
--- ---
src/mkwad.c | 2 -- src/mkwad.c | 2 --
1 file changed, 2 deletions(-) 1 file changed, 2 deletions(-)
Index: a/src/mkwad.c diff --git a/src/mkwad.c b/src/mkwad.c
=================================================================== index 45db4cd..3ad607b 100644
--- a/src/mkwad.c --- a/src/mkwad.c
+++ b/src/mkwad.c +++ b/src/mkwad.c
@@ -105,8 +105,6 @@ void WADRopenR(struct WADINFO *info, const char *wadin) @@ -105,8 +105,6 @@ void WADRopenR(struct WADINFO *info, const char *wadin)
@ -19,3 +20,6 @@ Index: a/src/mkwad.c
info->dirpos = dirpos = WADRreadLong(info); info->dirpos = dirpos = WADRreadLong(info);
if ((dirpos < 0) || (dirpos > 0x10000000L)) if ((dirpos < 0) || (dirpos > 0x10000000L))
ProgError("WR13", "%s: invalid directory offset %08lX", ProgError("WR13", "%s: invalid directory offset %08lX",
--
2.15.1

View File

@ -1,14 +1,19 @@
From: Jan Engelhardt <jengelh@medozas.de> From acd96b8c80a584d877845646ceac388feda46748 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Mon, 1 Jan 2018 19:28:24 +0100
Subject: [PATCH] build: fix gcc warnings abuot old K&R style function
declarations
Older gcc complain about the K&R-style prototype. Fix 'em.
(Forward ported from a deutex 4.4.x patch.)
src/deutex.c:108:1: warning: function declaration is not a prototype src/deutex.c:108:1: warning: function declaration is not a prototype
src/deutex.c:1611:13: warning: function declaration is not a prototype src/deutex.c:1611:13: warning: function declaration is not a prototype
--- ---
src/deutex.c | 4 ++-- src/deutex.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
Index: a/src/deutex.c diff --git a/src/deutex.c b/src/deutex.c
=================================================================== index 15ff8c3..505a352 100644
--- a/src/deutex.c --- a/src/deutex.c
+++ b/src/deutex.c +++ b/src/deutex.c
@@ -76,7 +76,7 @@ const char *palette_lump = "PLAYPAL"; @@ -76,7 +76,7 @@ const char *palette_lump = "PLAYPAL";
@ -29,3 +34,6 @@ Index: a/src/deutex.c
{ {
comdef_t *d; comdef_t *d;
comdef_t *current_section = NULL; comdef_t *current_section = NULL;
--
2.15.1

View File

@ -1,58 +1,47 @@
-------------------------------------------------------------------
Mon Jan 1 18:18:37 UTC 2018 - jengelh@inai.de
- Add 0001-increase-array-size-for-char-tname-variable-51.patch,
0001-Fix-strict-aliasing-violations.patch
- Explain some changelog entries better.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jan 1 07:58:11 UTC 2018 - avindra@opensuse.org Mon Jan 1 07:58:11 UTC 2018 - avindra@opensuse.org
- update to 5.1.0 - update to 5.1.0
* General * The -overwrite option now works.
- The -overwrite option now works. * Levels are extracted/inserted in a way to preserve GL nodes.
- Levels are extracted/inserted in a way to preserve GL nodes. * Inserting pictures with a height of 1 pixel no longer causes
- Inserting pictures with a height of 1 pixel no longer causes
a malloc error, and allows the operation of rebuilding a a malloc error, and allows the operation of rebuilding a
Doom 1 or 2 IWAD. Doom 1 or 2 IWAD.
- texture lump file names can now be overridden. * Texture lump file names can now be overridden.
* Graphics * Support reading and writing sprite offsets based on PNG
- DeuTex supports reading and writing sprite offsets based on "grAb" chunks (cf. grabpng package) in a manner compatible
PNG grab chunks in a manner compatible with SLADE and ZDoom. with SLADE and ZDoom. wadinfo.txt overrides these offsets
wadinfo.txt overrides these offsets unless -pngoffsets is used. unless -pngoffsets is used.
- includes 5.0.0 - includes 5.0.0
* Removed features * Removed DeuSF program mode.
- DeuSF. * Removed command line options used by WinTex.
- -man troff format generation. * Removed MS-DOS and OS/2 support code.
- WinTex options. * Removed the "-man" option from deutex.
- -fullsnd: now the only mode. * Removed incomplete Rise of the Triad support.
- MS-DOS and OS/2 compatibility. * PNG support added. This is the default extraction format now.
- Incomplete (and conditioned out) Rise of the Triad support. * Sun Audio (.au) and Creative .voc sound file format support
* File format support has been removed. RIFF WAVE is the only supported format.
- PNG support added, creating an optional dependency on libpng * Full sound lumps from the WAD are always extracted (-fullsnd
1.6. If compiled in, it is the default extraction format, option).
PPM otherwise. * MIDI files can be included just by being named *.mid, and are
- Au and VOC sound formats removed. WAV is the only supported extracted to the same file name extension.
format for extraction and creation. * Log file support has been removed, in favor of the user doing
- Full sound lumps from the WAD are always extracted. a shell redirection (e.g. with > or 2>) instead.
- MIDI files can be included just by being named *.mid, and * Arch-vile sprites are now extracted and inserted using
are extracted to the same file name extension. literal names for sprites with the '[' and ']' characters in
* General names (were illegal in DOS), and sprite names with '\' are
- Log file support has been removed, in favor of the user now altered to use '^' on-disk, matching the ZDoom PK3
doing a shell redirection (eg, with > or 2>) instead.
- Arch-vile sprites are now extracted and inserted using
literal names for sprites with the [ and ] characters in
names (was illegal in DOS), and sprite names with \ are
now altered to use ^ on-disk, matching the ZDoom PK3
standard. standard.
- Graphics with a height > 128 are now inserted into Doom WAD * Graphics with a height > 128 and < 256 are now inserted into
files correctly. Doom WAD files correctly.
- UDMF (Universal Doom Map Format) support. * UDMF (Universal Doom Map Format) support.
* Build systems, code standards
- Real Autoconf+Automake build system to replace the
barely-functioning imitation one. ./configure, make, and
related environment variables work as should be expected.
- MS-DOS and OS/2 batch files removed.
- A malloc.h include was removed to allow compilation on MacOS,
and is not needed by current Unix systems in general.
- Major cleanup, linting and refactoring
- C99-style cleanups to use (u)intN_t types, bool, true,
false throughout the code, replacing old defines.
- AsciiDoc now used for documentation
- cleanup with spec-cleaner
- remove patches obsoleted by upstream cleanup and refactoring - remove patches obsoleted by upstream cleanup and refactoring
* deutex-automake.diff * deutex-automake.diff
* deutex-braces.diff * deutex-braces.diff
@ -97,4 +86,3 @@ Sat Nov 8 16:49:24 CET 2008 - prusnak@suse.cz
Sun Dec 23 09:03:00 CET 2007 - claes.backstrom@fsfe.org Sun Dec 23 09:03:00 CET 2007 - claes.backstrom@fsfe.org
- Initial package built from Fedora package (4.4.0-6) - Initial package built from Fedora package (4.4.0-6)

View File

@ -22,44 +22,46 @@ Release: 0
Summary: WAD composer for Doom and related games Summary: WAD composer for Doom and related games
License: GPL-2.0+ License: GPL-2.0+
Group: Development/Tools/Other Group: Development/Tools/Other
URL: http://www.teaser.fr/~amajorel/deutex/ #Historic-Url: http://www.teaser.fr/~amajorel/deutex/
Source0: https://github.com/Doom-Utils/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz URL: https://github.com/Doom-Utils/deutex
Source1: https://github.com/Doom-Utils/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz.sig
Patch1: deutex-proto.diff Source: https://github.com/Doom-Utils/deutex/releases/download/v%version/%name-%version.tar.xz
Patch2: deutex-nolimit.diff Source2: https://github.com/Doom-Utils/deutex/releases/download/v%version/%name-%version.tar.xz.sig
Patch1: 0001-increase-array-size-for-char-tname-variable-51.patch
Patch2: 0001-Fix-strict-aliasing-violations.patch
Patch3: deutex-proto.diff
Patch4: deutex-nolimit.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: asciidoc BuildRequires: asciidoc
BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig BuildRequires: pkgconfig
Provides: deusf = %{version}
%description %description
DeuTex is a wad composer for Doom, Heretic, Hexen and Strife. It can DeuTex is a .wad file composer for Doom, Heretic, Hexen and Strife.
be used to extract the lumps of a wad and save them as individual It can be used to extract the lumps of a WAD and save them as
files. Conversely, it can also build a wad from separate files. When individual files. Conversely, it can also build a WAD from separate
extracting a lump to a file, it does not just copy the raw data, it files. When extracting a lump to a file, it does not just copy the
converts it to an appropriate format (such as PPM for graphics, Sun raw data, it converts it to an appropriate format (such as PNG for
audio for samples, etc.). Conversely, when it reads files for graphics, WAVE for audio samples, etc.). Conversely, when it reads
inclusion in pwads, it does the necessary conversions (for example, files for inclusion in PWADs, it does the necessary conversions (for
from PPM to Doom picture format). In addition, DeuTex has functions example, from PPM to Doom picture format). In addition, DeuTex has
such as merging wads, etc. functions such as merging WADs.
%prep %prep
%setup -q %setup -q
%patch -P 1 -P 2 -p1 %patch -P 1 -P 2 -P 3 -P 4 -p1
%build %build
autoreconf -fiv autoreconf -fiv
%configure %configure
make CFLAGS="%{optflags}" %{?_smp_mflags} make %{?_smp_mflags}
%install %install
%make_install %make_install
%files %files
%_bindir/*
%_mandir/man6/%name.6%ext_man
%doc COPYING COPYING.LIB %doc COPYING COPYING.LIB
%{_bindir}/%{name}
%{_mandir}/man6/%{name}.6%{ext_man}
%changelog %changelog