Re: [PATCH v3] date: detect underflow/overflow when parsing dates with timezone offset
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 11, 2024, 23:30 UTC
- Message-ID
- <xmqqtthzrraw.fsf@gitster.g>
- In-Reply-To
- <xmqq1q58ejnw.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> I wonder if this should be of timestamp_t type instead, as the check > is done against *timestamp in parse_date_basic() where *timestamp is > of type timestamp_t to match?
Also, as you can see at one of the GitHub CI jobs, e.g.,
https://github.com/git/git/actions/runs/9455916669/job/26046731619#step:6:1915
you'd need to either exclude some "these are too large timestamps for the system" tests from 32-bit systems or expect output on them to be different from 64-bit systems.
As you are actively detecting the condition and giving an error message "too large for _this_ system", I think it is a good idea to actually do the latter, i.e. on 64-bit system make sure parsing is done correctly, and on 32-bit system make sure you get that "too large for this system" error.
Thanks.