From patchwork Sun Sep 9 15:26:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 29278 Received: (qmail 108356 invoked by alias); 9 Sep 2018 15:26:23 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 108347 invoked by uid 89); 9 Sep 2018 15:26:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=H*MI:ucla, H*MI:edu, daylight, H*Ad:D*edu X-HELO: zimbra.cs.ucla.edu From: Paul Eggert To: libc-alpha@sourceware.org Cc: Paul Eggert Subject: [PATCH 1/2] Fix tzfile low-memory assertion failure Date: Sun, 9 Sep 2018 08:26:09 -0700 Message-Id: <20180909152610.4602-1-eggert@cs.ucla.edu> [BZ #21716] * time/tzfile.c (__tzfile_read): Check for memory exhaustion when registering time zone abbreviations. --- ChangeLog | 7 +++++++ time/tzfile.c | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 611caf9bd8..6f95da9ce2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-09-09 Paul Eggert + + Fix tzfile low-memory assertion failure + [BZ #21716] + * time/tzfile.c (__tzfile_read): Check for memory exhaustion + when registering time zone abbreviations. + 2018-09-06 Stefan Liebler * sysdeps/s390/fpu/libm-test-ulps: Regenerated. diff --git a/time/tzfile.c b/time/tzfile.c index 2a385b92bc..ea6e940303 100644 --- a/time/tzfile.c +++ b/time/tzfile.c @@ -410,7 +410,8 @@ __tzfile_read (const char *file, size_t extra, char **extrap) /* First "register" all timezone names. */ for (i = 0; i < num_types; ++i) - (void) __tzstring (&zone_names[types[i].idx]); + if (__tzstring (&zone_names[types[i].idx]) == NULL) + goto ret_free_transitions; /* Find the standard and daylight time offsets used by the rule file. We choose the offsets in the types of each flavor that are