[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#409517: dvipdfm segfault related to /etc/localtime



Can you try the attached patch (after applying the earlier patch)? On 32 bit machines, longs and ints are usually the same. They're different on AMD64. That's why the error was only noticed on that architecture.

On Mon, 12 Feb 2007, Martin Michlmayr wrote:

I put in a printf and this is what date_string is set to:

D:20070212105153+01'140733193388032'

Thanks.  That was what I needed to locate the problem.

Although now I'm confused.  How can this string be 36 characters when
the length of the date_string array is 25?

That's why it was crashing. The printf was writing 36 characters which overran the 25 byte buffer.

Mark



--- pdfdoc.c.orig	2007-02-12 18:28:36.000000000 -0500
+++ pdfdoc.c	2007-02-12 18:28:46.000000000 -0500
@@ -260,7 +260,7 @@
     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);
+	     (tz_offset>0)? '+':'-', labs(tz_offset)/3600, (labs(tz_offset)/60)%60);
   }
   return date_string;
 }

Reply to: