NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/60452: gmtime, gmtime_r put wrong time zone into result
The following reply was made to PR lib/60452; it has been noted by GNATS.
From: Thomas Klausner <wiz%netbsd.org@localhost>
To: Robert Elz <kre%munnari.oz.au@localhost>
Cc: gnats-bugs%netbsd.org@localhost
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
Home |
Main Index |
Thread Index |
Old Index