Skip to content

time: Year overflow for time.Date #5923

@gbin

Description

@gbin
What steps will reproduce the problem?
// Get the value of 
time.Unix(-0x7FFFFFFBF5184BFB, -0x8000000000000000).Year() // good -292277022399
// and compare it to the one just below 
time.Unix(-0x7FFFFFFBF5184BFC, -0x8000000000000000).Year() // bad 292277026854

You can play with it here : http://play.golang.org/p/SnAdKtD-_y

What is the expected output?
Year should be in the same order as the timestamp

What do you see instead?
Year overflows

Which compiler are you using (5g, 6g, 8g, gccgo)?
gc/bin/go tool 6g

Which operating system are you using?
Linux 64bits

Which version are you using?  (run 'go version')
go version go1.1.1 linux/amd64

Please provide any additional information below.
It might be completely minor but I could imagine some security issues in validation
functions checking if the year of a given date is in the past.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions