Skip to content

Commit

Permalink
tzinfo: bounds check transitions.len before access
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Culverhouse <[email protected]>
  • Loading branch information
rockorager committed Aug 9, 2024
1 parent 1f6cc01 commit 9cca8ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/timezone.zig
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ pub const TZInfo = struct {
pub fn adjust(self: TZInfo, timestamp: i64) AdjustedTime {
// if we are past the last transition and have a footer, we use the
// footer data
if (self.transitions[self.transitions.len - 1].ts <= timestamp and
if ((self.transitions.len == 0 or self.transitions[self.transitions.len - 1].ts <= timestamp) and
self.posix_tz != null)
{
const posix = self.posix_tz.?;
Expand Down

0 comments on commit 9cca8ec

Please sign in to comment.