Project

General

Profile

Actions

Bug #12348

open

gmtime/localtime erroneously fail EOVERFLOW with the minimum possible input value

Added by Rich Lowe about 2 years ago. Updated 10 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
lib - userland libraries
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Tags:
Gerrit CR:

Description

When fed the time_t representing the minimal possible value, we fail because underflow because 'y' ends up with a value one too low, and so we fail EOVERFLOW.

You can reproduce by feeding timegm a `struct tm` with an INT_MIN year.

Actions #1

Updated by Rich Lowe 10 months ago

I was asked about this ages ago, but forgot to provide the awful test case I'd been using.

It's here: https://gist.github.com/richlowe/8a84030dfd360fabd2b508da26a4db06

Actions

Also available in: Atom PDF