Bug#291438: tetex-bin: dvipdfm segfaults when used with hyperref and hypertex
The patch I have incorporated is attached. It's similar to the Gentoo
patch, but different in two ways:
1) It doesn't depend on the rounding direction of '/' (this may not be
an issue today)
2) It always uses gmtoff when it's available.
I hope you are able to use it. It corrects some fairly serious problems.
Without this patch, the code really doesn't do what's intended.
Mark
On Tue, 2 Jan 2007, Hilmar Preusse wrote:
Date: Tue, 2 Jan 2007 19:48:17 +0100
From: Hilmar Preusse <hille42@web.de>
To: Mark A. Wicks <mwicks@kettering.edu>, 291438@bugs.debian.org
Subject: Re: Bug#291438: tetex-bin: dvipdfm segfaults when used with hyperref
and hypertex
On 02.01.07 Mark A. Wicks (mwicks@kettering.edu) wrote:
Hi,
I am reserving some time tonight hopefully to finish this. I hope
to send a patch tomorrow.
I am sorry I didn't fix this ealier.
Good, to hear that. BTW we got that report another time on
http://bugs.debian.org/403245 . The submitter posted a patch. Maybe
it is worth to have a look at it.
Thanks,
Hilmar
--
sigmentation fault
______________________________________________________________________
Mark A. Wicks mwicks@kettering.edu
Professor and Head
ECE Department, Kettering University Voice: (810) 762-7992
1700 West Third Ave, Flint, MI 48504-4898 Fax: (810) 762-9830
--- pdfdoc.c.orig 2007-01-02 20:13:27.000000000 -0500
+++ pdfdoc.c 2007-01-02 23:04:31.000000000 -0500
@@ -231,13 +231,7 @@
static char *asn_date (void)
{
-#ifndef HAVE_TIMEZONE
- #ifdef TM_GM_TOFF
- #define timezone (bdtime->gm_toff)
- #else
- #define timezone 0l
-#endif /* TM_GM_TOFF */
-#endif /* HAVE_TIMEZONE */
+ long tz_offset;
static char date_string[24];
time_t current_time;
struct tm *bd_time;
@@ -246,10 +240,28 @@
}
time(¤t_time);
bd_time = localtime(¤t_time);
- sprintf (date_string, "D:%04d%02d%02d%02d%02d%02d%+03ld'%02ld'",
- bd_time -> tm_year+1900, bd_time -> tm_mon+1, bd_time -> tm_mday,
- bd_time -> tm_hour, bd_time -> tm_min, bd_time -> tm_sec,
- -timezone/3600, timezone%3600);
+
+#ifdef HAVE_TM_GMTOFF /* Preferred way to get time zone offset */
+ tz_offset = bd_time->tm_gmtoff;
+#else
+#ifdef HAVE_TIMEZONE /* Plan B --- use external variable 'timezone'
+ /* (may not provide correct offset for daylight savings time) */
+ tz_offset = - timezone;
+#else /* Last resort --- without more information, set offset to zero */
+ tz_offset = 0l;
+#endif /* HAVE_TIMEZONE */
+#endif /* HAVE_TM_GMTOFF */
+
+ if (tz_offset == 0l) {
+ sprintf (date_string, "D:%04d%02d%02d%02d%02d%02dZ00'00'",
+ bd_time -> tm_year+1900, bd_time -> tm_mon+1, bd_time -> tm_mday,
+ bd_time -> tm_hour, bd_time -> tm_min, bd_time -> tm_sec);
+ } else {
+ sprintf (date_string, "D:%04d%02d%02d%02d%02d%02d%c%02ld'%02ld'",
+ bd_time -> tm_year+1900, bd_time -> tm_mon+1, bd_time -> tm_mday,
+ bd_time -> tm_hour, bd_time -> tm_min, bd_time -> tm_sec,
+ (tz_offset>0)? '+':'-', abs(tz_offset)/3600, (abs(tz_offset)/60)%60);
+ }
return date_string;
}
--- configure.orig 2001-06-28 15:55:26.000000000 -0400
+++ configure 2007-01-03 10:09:08.000000000 -0500
@@ -927,7 +927,7 @@
#line 928 "configure"
#include "confdefs.h"
#include <stdio.h>
-#include <kpathsea/tex-file.h>
+#include <kpathsea/kpathsea.h>
int main() {
kpse_tex_ps_header_format;
kpse_type1_format;kpse_vf_format
@@ -950,7 +950,7 @@
If you are sure they are installed and in a standard place, maybe you need a
newer version of kpathsea? You also might try setting the environment
variable CPPFLAGS (or CFLAGS) with -I pointing to the directory containing
-the file "tex-file.h"
+the file "kpathsea.h"
" 1>&2; exit 1; }
fi
@@ -961,7 +961,7 @@
#line 962 "configure"
#include "confdefs.h"
#include <stdio.h>
-#include <kpathsea/tex-file.h>
+#include <kpathsea/kpathsea.h>
int main() {
kpse_ofm_format
; return 0; }
Reply to: