From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 4710B3858018; Thu, 7 Oct 2021 14:12:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4710B3858018 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] Fix subscript error with odd TZif file [BZ #28338] X-Act-Checkin: glibc X-Git-Author: Paul Eggert X-Git-Refname: refs/heads/master X-Git-Oldrev: f2e06656d04a9fcb0603802a4f8ce7aa3a1f055e X-Git-Newrev: 645277434a42efc547d2cac8bfede4da10b4049f Message-Id: <20211007141233.4710B3858018@sourceware.org> Date: Thu, 7 Oct 2021 14:12:33 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2021 14:12:33 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=645277434a42efc547d2cac8bfede4da10b4049f commit 645277434a42efc547d2cac8bfede4da10b4049f Author: Paul Eggert Date: Mon Sep 13 22:49:45 2021 -0700 Fix subscript error with odd TZif file [BZ #28338] * time/tzfile.c (__tzfile_compute): Fix unlikely off-by-one bug that accessed before start of an array when an oddball-but-valid TZif file was queried with an unusual time_t value. Reviewed-by: Adhemerval Zanella Diff: --- time/tzfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/time/tzfile.c b/time/tzfile.c index 4377018a55..190a777152 100644 --- a/time/tzfile.c +++ b/time/tzfile.c @@ -765,8 +765,7 @@ __tzfile_compute (__time64_t timer, int use_localtime, *leap_correct = leaps[i].change; if (timer == leaps[i].transition /* Exactly at the transition time. */ - && ((i == 0 && leaps[i].change > 0) - || leaps[i].change > leaps[i - 1].change)) + && (leaps[i].change > (i == 0 ? 0 : leaps[i - 1].change))) { *leap_hit = 1; while (i > 0