public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Fix subscript error with odd TZif file [BZ #28338]
@ 2021-10-07 14:12 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2021-10-07 14:12 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=645277434a42efc547d2cac8bfede4da10b4049f

commit 645277434a42efc547d2cac8bfede4da10b4049f
Author: Paul Eggert <eggert@cs.ucla.edu>
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  <adhemerval.zanella@linaro.org>

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-07 14:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 14:12 [glibc] Fix subscript error with odd TZif file [BZ #28338] Adhemerval Zanella

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).