Package: t1utils
Version: 1.40-1
Severity: serious
Tags: patch
User: [email protected]
Usertags: origin-ubuntu artful ubuntu-patch
Hi Niels,
The latest version of t1utils is using the memmem() function, which
according to the manpage requires the use of the _GNU_SOURCE define in order
to get the prototype. Without this, the compiler of course assumes memmem()
returns an int instead of a pointer, resulting in a segfault on any 64-bit
architectures.
The problem can be seen as warnings in the build log:
gcc -DHAVE_CONFIG_H -I. -I./include -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat
-Werror=format-security -c -o t1disasm.o t1disasm.c
In file included from t1disasm.c:73:0:
t1asmhelp.h: In function 'set_lenIV':
t1asmhelp.h:13:13: warning: implicit declaration of function 'memmem'
[-Wimplicit-function-declaration]
char* p = memmem(line, line_len, "/lenIV ", 7);
^~~~~~
t1asmhelp.h:13:13: warning: initialization makes pointer from integer without a
cast [-Wint-conversion]
t1asmhelp.h: In function 'set_cs_start':
t1asmhelp.h:37:12: warning: assignment makes pointer from integer without a
cast [-Wint-conversion]
if ((p = memmem(line, line_len, "string currentfile", 18))
^
In file included from t1asm.c:69:0:
t1asmhelp.h: In function 'set_lenIV':
t1asmhelp.h:13:13: warning: implicit declaration of function 'memmem'
[-Wimplicit-function-declaration]
char* p = memmem(line, line_len, "/lenIV ", 7);
^~~~~~
t1asmhelp.h:13:13: warning: initialization makes pointer from integer without a
cast [-Wint-conversion]
t1asmhelp.h: In function 'set_cs_start':
t1asmhelp.h:37:12: warning: assignment makes pointer from integer without a
cast [-Wint-conversion]
if ((p = memmem(line, line_len, "string currentfile", 18))
^
t1disasm.c: In function 'eexec_line':
t1disasm.c:387:28: warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
const char *CharStrings = (const char *)
^
https://buildd.debian.org/status/fetch.php?pkg=t1utils&arch=amd64&ver=1.40-1&stamp=1500932845&raw=0
This in turn causes the lintian test suite to fail, as seen at
<https://ci.debian.net/data/autopkgtest/unstable/amd64/l/lintian/20170725_022013/log.gz>.
The attached patch addresses this issue.
Thanks,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
[email protected] [email protected]
diff -Nru t1utils-1.40/debian/patches/memmem-declaration.patch
t1utils-1.40/debian/patches/memmem-declaration.patch
--- t1utils-1.40/debian/patches/memmem-declaration.patch 1969-12-31
16:00:00.000000000 -0800
+++ t1utils-1.40/debian/patches/memmem-declaration.patch 2017-07-25
23:55:42.000000000 -0700
@@ -0,0 +1,29 @@
+Description: add define needed for missing memmem() declaration
+ memmem() returns a pointer, so without this, t1asm segfaults on 64-bit
+ architectures.
+Author: Steve Langasek <[email protected]>
+
+Index: t1utils-1.40/t1asm.c
+===================================================================
+--- t1utils-1.40.orig/t1asm.c
++++ t1utils-1.40/t1asm.c
+@@ -50,6 +50,7 @@
+
+ /* Note: this is ANSI C. */
+
++#define _GNU_SOURCE
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+Index: t1utils-1.40/t1disasm.c
+===================================================================
+--- t1utils-1.40.orig/t1disasm.c
++++ t1utils-1.40/t1disasm.c
+@@ -53,6 +53,7 @@
+
+ /* Note: this is ANSI C. */
+
++#define _GNU_SOURCE
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
diff -Nru t1utils-1.40/debian/patches/series t1utils-1.40/debian/patches/series
--- t1utils-1.40/debian/patches/series 1969-12-31 16:00:00.000000000 -0800
+++ t1utils-1.40/debian/patches/series 2017-07-25 23:54:20.000000000 -0700
@@ -0,0 +1 @@
+memmem-declaration.patch