From 01054533a4db747ac2ac5d21727e2e4aa33eeb3e6afec3ea59dd58d8e036ca63 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 1 Jan 2018 19:21:51 +0000 Subject: [PATCH] - 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 --- 0001-Fix-strict-aliasing-violations.patch | 98 +++++++++++++++++++ ...rray-size-for-char-tname-variable-51.patch | 30 ++++++ deutex-nolimit.diff | 14 ++- deutex-proto.diff | 18 +++- deutex.changes | 90 ++++++++--------- deutex.spec | 44 +++++---- 6 files changed, 212 insertions(+), 82 deletions(-) create mode 100644 0001-Fix-strict-aliasing-violations.patch create mode 100644 0001-increase-array-size-for-char-tname-variable-51.patch diff --git a/0001-Fix-strict-aliasing-violations.patch b/0001-Fix-strict-aliasing-violations.patch new file mode 100644 index 0000000..6634d85 --- /dev/null +++ b/0001-Fix-strict-aliasing-violations.patch @@ -0,0 +1,98 @@ +From 8531292e3e13f713188187e21565b81669c9e0c7 Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +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 *) ¤t_section->com) = (short) width2r; +deutex.c:1237:17: warning: + if (*((short *) ¤t_section->com) != width2r) +deutex.c:1239:21: warning: + *((short *) ¤t_section->com) = SHRT_MAX; +deutex.c:1241:17: warning: + *((short *) ¤t_section->exec) = (short) width1t; +deutex.c:1242:17: warning: + if (*((short *) ¤t_section->exec) != width1t) +deutex.c:1244:21: warning: + *((short *) ¤t_section->exec) = SHRT_MAX; +deutex.c:1246:17: warning: + *((short *) ¤t_section->use) = (short) width2t; +deutex.c:1247:17: warning: + if (*((short *) ¤t_section->use) != width2t) +deutex.c:1249:21: warning: + *((short *) ¤t_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 *) ¤t_section->com) = (short) width2r; +- if (*((short *) ¤t_section->com) != width2r) ++ tmp = width2r; ++ if (tmp != width2r) + /* Can't happen */ +- *((short *) ¤t_section->com) = SHRT_MAX; ++ tmp = SHRT_MAX; ++ memcpy(¤t_section->com, &tmp, sizeof(tmp)); + +- *((short *) ¤t_section->exec) = (short) width1t; +- if (*((short *) ¤t_section->exec) != width1t) +- /* Can't happen */ +- *((short *) ¤t_section->exec) = SHRT_MAX; ++ tmp = width1t; ++ if (tmp != width1t) ++ tmp = SHRT_MAX; ++ memcpy(¤t_section->exec, &tmp, sizeof(tmp)); + +- *((short *) ¤t_section->use) = (short) width2t; +- if (*((short *) ¤t_section->use) != width2t) +- /* Can't happen */ +- *((short *) ¤t_section->use) = SHRT_MAX; ++ tmp = width2t; ++ if (tmp != width2t) ++ tmp = SHRT_MAX; ++ memcpy(¤t_section->use, &tmp, sizeof(tmp)); + } + } + +-- +2.15.1 + diff --git a/0001-increase-array-size-for-char-tname-variable-51.patch b/0001-increase-array-size-for-char-tname-variable-51.patch new file mode 100644 index 0000000..8295a6a --- /dev/null +++ b/0001-increase-array-size-for-char-tname-variable-51.patch @@ -0,0 +1,30 @@ +From 7024dd74a33780ef2dbdf614f4e52526cc3ab457 Mon Sep 17 00:00:00 2001 +From: Fabian Greffrath +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 + diff --git a/deutex-nolimit.diff b/deutex-nolimit.diff index 934f4d3..e69e35d 100644 --- a/deutex-nolimit.diff +++ b/deutex-nolimit.diff @@ -1,13 +1,14 @@ +From 4a59997a18cb1c5269b05ef3f7a2fcd3ba2f7552 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt -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(-) -Index: a/src/mkwad.c -=================================================================== +diff --git a/src/mkwad.c b/src/mkwad.c +index 45db4cd..3ad607b 100644 --- a/src/mkwad.c +++ b/src/mkwad.c @@ -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); if ((dirpos < 0) || (dirpos > 0x10000000L)) ProgError("WR13", "%s: invalid directory offset %08lX", +-- +2.15.1 + diff --git a/deutex-proto.diff b/deutex-proto.diff index ed0fe09..ea9cc33 100644 --- a/deutex-proto.diff +++ b/deutex-proto.diff @@ -1,14 +1,19 @@ -From: Jan Engelhardt +From acd96b8c80a584d877845646ceac388feda46748 Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +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:1611:13: warning: function declaration is not a prototype - --- - src/deutex.c | 4 ++-- + src/deutex.c | 4 ++-- 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 +++ b/src/deutex.c @@ -76,7 +76,7 @@ const char *palette_lump = "PLAYPAL"; @@ -29,3 +34,6 @@ Index: a/src/deutex.c { comdef_t *d; comdef_t *current_section = NULL; +-- +2.15.1 + diff --git a/deutex.changes b/deutex.changes index 1084d8e..0f07801 100644 --- a/deutex.changes +++ b/deutex.changes @@ -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 - update to 5.1.0 - * General - - The -overwrite option now works. - - Levels are extracted/inserted in a way to preserve GL nodes. - - Inserting pictures with a height of 1 pixel no longer causes - a malloc error, and allows the operation of rebuilding a - Doom 1 or 2 IWAD. - - texture lump file names can now be overridden. - * Graphics - - DeuTex supports reading and writing sprite offsets based on - PNG grab chunks in a manner compatible with SLADE and ZDoom. - wadinfo.txt overrides these offsets unless -pngoffsets is used. + * The -overwrite option now works. + * Levels are extracted/inserted in a way to preserve GL nodes. + * Inserting pictures with a height of 1 pixel no longer causes + a malloc error, and allows the operation of rebuilding a + Doom 1 or 2 IWAD. + * Texture lump file names can now be overridden. + * Support reading and writing sprite offsets based on PNG + "grAb" chunks (cf. grabpng package) in a manner compatible + with SLADE and ZDoom. wadinfo.txt overrides these offsets + unless -pngoffsets is used. - includes 5.0.0 - * Removed features - - DeuSF. - - -man troff format generation. - - WinTex options. - - -fullsnd: now the only mode. - - MS-DOS and OS/2 compatibility. - - Incomplete (and conditioned out) Rise of the Triad support. - * File format support - - PNG support added, creating an optional dependency on libpng - 1.6. If compiled in, it is the default extraction format, - PPM otherwise. - - Au and VOC sound formats removed. WAV is the only supported - format for extraction and creation. - - Full sound lumps from the WAD are always extracted. - - MIDI files can be included just by being named *.mid, and - are extracted to the same file name extension. - * General - - Log file support has been removed, in favor of the user - 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. - - Graphics with a height > 128 are now inserted into Doom WAD - files correctly. - - 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 + * Removed DeuSF program mode. + * Removed command line options used by WinTex. + * Removed MS-DOS and OS/2 support code. + * Removed the "-man" option from deutex. + * Removed incomplete Rise of the Triad support. + * PNG support added. This is the default extraction format now. + * Sun Audio (.au) and Creative .voc sound file format support + has been removed. RIFF WAVE is the only supported format. + * Full sound lumps from the WAD are always extracted (-fullsnd + option). + * MIDI files can be included just by being named *.mid, and are + extracted to the same file name extension. + * Log file support has been removed, in favor of the user doing + a shell redirection (e.g. with > or 2>) instead. + * Arch-vile sprites are now extracted and inserted using + literal names for sprites with the '[' and ']' characters in + names (were illegal in DOS), and sprite names with '\' are + now altered to use '^' on-disk, matching the ZDoom PK3 + standard. + * Graphics with a height > 128 and < 256 are now inserted into + Doom WAD files correctly. + * UDMF (Universal Doom Map Format) support. - remove patches obsoleted by upstream cleanup and refactoring * deutex-automake.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 - Initial package built from Fedora package (4.4.0-6) - diff --git a/deutex.spec b/deutex.spec index 6ce4840..598e8cd 100644 --- a/deutex.spec +++ b/deutex.spec @@ -22,44 +22,46 @@ Release: 0 Summary: WAD composer for Doom and related games License: GPL-2.0+ Group: Development/Tools/Other -URL: http://www.teaser.fr/~amajorel/deutex/ -Source0: https://github.com/Doom-Utils/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz -Source1: https://github.com/Doom-Utils/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz.sig -Patch1: deutex-proto.diff -Patch2: deutex-nolimit.diff +#Historic-Url: http://www.teaser.fr/~amajorel/deutex/ +URL: https://github.com/Doom-Utils/deutex + +Source: https://github.com/Doom-Utils/deutex/releases/download/v%version/%name-%version.tar.xz +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: autoconf BuildRequires: automake -BuildRequires: libtool BuildRequires: pkgconfig -Provides: deusf = %{version} %description -DeuTex is a wad composer for Doom, Heretic, Hexen and Strife. It can -be used to extract the lumps of a wad and save them as individual -files. Conversely, it can also build a wad from separate files. When -extracting a lump to a file, it does not just copy the raw data, it -converts it to an appropriate format (such as PPM for graphics, Sun -audio for samples, etc.). Conversely, when it reads files for -inclusion in pwads, it does the necessary conversions (for example, -from PPM to Doom picture format). In addition, DeuTex has functions -such as merging wads, etc. +DeuTex is a .wad file composer for Doom, Heretic, Hexen and Strife. +It can be used to extract the lumps of a WAD and save them as +individual files. Conversely, it can also build a WAD from separate +files. When extracting a lump to a file, it does not just copy the +raw data, it converts it to an appropriate format (such as PNG for +graphics, WAVE for audio samples, etc.). Conversely, when it reads +files for inclusion in PWADs, it does the necessary conversions (for +example, from PPM to Doom picture format). In addition, DeuTex has +functions such as merging WADs. %prep %setup -q -%patch -P 1 -P 2 -p1 +%patch -P 1 -P 2 -P 3 -P 4 -p1 %build autoreconf -fiv %configure -make CFLAGS="%{optflags}" %{?_smp_mflags} +make %{?_smp_mflags} %install %make_install %files +%_bindir/* +%_mandir/man6/%name.6%ext_man %doc COPYING COPYING.LIB -%{_bindir}/%{name} -%{_mandir}/man6/%{name}.6%{ext_man} %changelog