Re: lib/60452: gmtime, gmtime_r put wrong time zone into result

"Thomas Klausner via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
The following reply was made to PR lib/60452; it has been noted by GNATS.

From: Thomas Klausner <[email protected]>
To: Robert Elz <[email protected]>
Cc: [email protected]
Subject: Re: lib/60452: gmtime, gmtime_r put wrong time zone into result
Date: Thu, 16 Jul 2026 20:46:25 +0200

 On Fri, Jul 17, 2026 at 01:40:46AM +0100, Robert Elz wrote:
 > It is easy to test which that is, simply make the f_gmtime() function
 > in your test be:
 > 
 > void f_gmtime(time_t secs, struct tm *tmp) {
 >   memset(tmp, 0, sizeof(*tmp));
 >   if (gmtime_r(&secs, tmp) == NULL)
 >     err(1, "gmtime_r failed");
 >   tmp->tm_gmtoff = -1234;
 >   tmp->tm_zone = (char *)-1234;
 > }
 > 
 > and see what the effect is on those systems.
 
 macOS:
 
 cc     jq.c   -o jq
 ./test.sh: line 3: 53331 Segmentation fault: 11  TZ=Etc/GMT+7 ./jq
 ./test.sh: line 4: 53332 Segmentation fault: 11  ./jq
 
 Debian:
 
 cc     jq.c   -o jq
 Segmentation fault
 Segmentation fault
 
 FreeBSD:
 
 cc -O2 -pipe  jq.c  -o jq
 In-address space security exception (core dumped)
 In-address space security exception (core dumped)
 
  Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.