Skip to content

Commit

Permalink
Sanity check for report timestamps (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoEmbrace authored Dec 4, 2024
1 parent 0468c29 commit 6ce4257
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Sources/KSCrashRecording/KSCrashReportFixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,14 @@ static int onIntegerElement(const char* const name,
{
char buffer[28];

if(matchesMinVersion(context, 3, 3, 0))
int64_t now = ksdate_microseconds();
int64_t addedYears = 3155695200000; // 100 years in milliseconds
int64_t distantFutureInMilliseconds = (now / 1000) + addedYears;

if(value > distantFutureInMilliseconds || matchesMinVersion(context, 3, 3, 0))
{
ksdate_utcStringFromMicroseconds(value, buffer);
int64_t v = value > now ? now : value;
ksdate_utcStringFromMicroseconds(v, buffer);
}
else
{
Expand Down

0 comments on commit 6ce4257

Please sign in to comment.