Decoder: validate bounds of day and month in dates (#680)

Fixes #676
This commit is contained in:
Thomas Pelletier
2021-11-24 17:42:01 -05:00
committed by GitHub
parent 2b3de620e8
commit 8eae15b2ee
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -462,7 +462,7 @@ func checkAndRemoveUnderscoresFloats(b []byte) ([]byte, error) {
// isValidDate checks if a provided date is a date that exists.
func isValidDate(year int, month int, day int) bool {
return day <= daysIn(month, year)
return month > 0 && month < 13 && day > 0 && day <= daysIn(month, year)
}
// daysBefore[m] counts the number of days in a non-leap year