prevent int64 overflow when reading the expiry date of the server config

This commit is contained in:
Marten Seemann
2016-11-16 12:42:19 +07:00
parent f9013edb77
commit 52ba2ce9f8
4 changed files with 26 additions and 1 deletions

View File

@@ -235,6 +235,13 @@ var _ = Describe("Server Config", func() {
err := scfg.parseValues(tagMap)
Expect(err).To(MatchError("CryptoInvalidValueLength: EXPY"))
})
It("deals with absurdly large timestamps", func() {
tagMap[TagEXPY] = bytes.Repeat([]byte{0xff}, 8) // this would overflow the int64
err := scfg.parseValues(tagMap)
Expect(err).ToNot(HaveOccurred())
Expect(scfg.expiry.After(time.Now())).To(BeTrue())
})
})
})
})