Skip to content

Commit

Permalink
time-to-live returned incorrect results when SOURCE_DATE_EPOCH set (#278
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Cristy committed Oct 11, 2023
1 parent 7100cc9 commit eb9ac36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion magick/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ static Cache GetImagePixelCache(Image *image,const MagickBooleanType clone,
cpu_throttle=GetMagickResourceLimit(ThrottleResource);
if ((cycles++ % 4096) == 0)
{
if (GetMagickTTL() < 0)
if (GetMagickTTL() <= 0)
{
cache_info=(CacheInfo *) image->cache;
if (cache_info->file != -1)
Expand Down
5 changes: 3 additions & 2 deletions magick/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ MagickExport time_t GetMagickTime(void)
time_t
epoch;

epoch=(time_t) StringToDouble(source_date_epoch,(char **) NULL);
epoch=(time_t) CastDoubleToLong(StringToDouble(source_date_epoch,
(char **) NULL));
if ((epoch > 0) && (epoch <= time((time_t *) NULL)))
constant_magick_time=epoch;
}
Expand Down Expand Up @@ -388,7 +389,7 @@ MagickPrivate MagickOffsetType GetMagickTTL(void)
magick_epoch=time((time_t *) NULL);
}
return((MagickOffsetType) GetMagickResourceLimit(TimeResource)-
(GetMagickTime()-magick_epoch));
(time((time_t *) NULL)-magick_epoch));
}

/*
Expand Down

0 comments on commit eb9ac36

Please sign in to comment.