This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug time/23414] New: tzset integer overlow with 32-bit time_t when using TZ without DST rules


https://sourceware.org/bugzilla/show_bug.cgi?id=23414

            Bug ID: 23414
           Summary: tzset integer overlow with 32-bit time_t when using TZ
                    without DST rules
           Product: glibc
           Version: 2.27
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: qboosh@pld-linux.org
  Target Milestone: ---

Created attachment 11129
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11129&action=edit
Proof of concent fix for the bug.

Recently tzdata includes pre-1901 rules, which are fully stored in 64-bit part
of tz files, and the last one is stored under INT32_MIN transition in 32-bit
part.

tzset() code, when using with TZ without DST rules, (re)reads default tz file
(posixrules), applying offset change (as difference between TZ offset and tz
file offset) to all transitions, including the one having INT32_MIN value of
32-bit time_t.
If TZ is on the west of default tz, difference is negative and thus time_t
overflows, causes omitting of all transitions during time calculations.

Test case:
assume some system timezone, e.g. Europe/Warsaw. Then in the summer time:
TZ=GMT0BST date
should return BST time (and it happens on systems with 64-bit time_t), but on
systems with 32-bit time_t returns GMT time.
Problem doesn't occur in the opposite direction (system tz is Europe/London and
trying TZ=CET-1CEST) because difference is positive and there is no overflow.

I'm attaching proof-of-concent fix (probably not the final one).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]