public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hp at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug time/28707] New: assert in tzfile.c __tzfile_read striking with truncated timezones generated by tzcode-2021d and later
Date: Fri, 17 Dec 2021 00:49:44 +0000	[thread overview]
Message-ID: <bug-28707-131@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 28707
           Summary: assert in tzfile.c __tzfile_read striking with
                    truncated timezones generated by tzcode-2021d and
                    later
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: hp at sourceware dot org
  Target Milestone: ---

Created attachment 13858
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13858&action=edit
git patch with test-case

When using a timezone file generated by the zic in IANA
tzcode-2021d a.k.a. tzlib-2021d (also in tzlib-2021e; current as
of this writing), glibc asserts in __tzfile_read (on
e.g. tzset() for this file) and you may find lines matching
"tzfile.c:435: __tzfile_read: Assertion `num_types == 1' failed"
in your syslog.

Attached is a test-case including the tzfile for Asuncion
generated by tzlib-2021e as follows, using the tzlib-2021e zic:
"zic -d DEST -r @1546300800 -L /dev/null -b slim
SOURCE/southamerica".  Note that in its type 2 header, it has
two entries in its "time-types" array (types), but only one
entry in its "transition types" array (type_idxs).

This is valid and expected already in the published RFC8536, and
not even frowned upon: "Local time for timestamps before the
first transition is specified by the first time type (time type
0)" ... "every nonzero local time type index SHOULD appear at
least once in the transition type array".  Note the "nonzero ...
index".  Until the 2021d zic, index 0 has been shared by the
first valid transition but with 2021d it's separate, set apart
as a placeholder and only "implicitly" indexed.  (A draft update
of the RFC mandates that the entry at index 0 is a placeholder
in this case, hence can no longer be shared.)

So, unless glibc is specifically intended only to be used with
timezone-files generated by its own zic (an older version of the
tzcode zic), as opposed to e.g. timezone-files generated by
current (IANA) tzcode otherwise following RFC8536, the assert is
invalid.

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

             reply	other threads:[~2021-12-17  0:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17  0:49 hp at sourceware dot org [this message]
2021-12-17  1:00 ` [Bug time/28707] " hp at sourceware dot org
2021-12-30 11:16 ` cvs-commit at gcc dot gnu.org
2021-12-30 11:24 ` adhemerval.zanella at linaro dot org
2021-12-30 21:31 ` hp at sourceware dot org
2022-01-04 18:02 ` fweimer at redhat dot com
2022-01-04 18:03 ` fweimer at redhat dot com
2022-01-07  9:41 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28707-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).