decode: fix maximum time offset values (#706)
According to RFC3339 section 5.6, the maximum time offset values for hours and minutes is 23 and 59, respectively.
This commit is contained in:
@@ -117,7 +117,7 @@ func parseDateTime(b []byte) (time.Time, error) {
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
if hours > 24 {
|
||||
if hours > 23 {
|
||||
return time.Time{}, newDecodeError(b[:1], "invalid timezone offset hours")
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ func parseDateTime(b []byte) (time.Time, error) {
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
if minutes > 60 {
|
||||
if minutes > 59 {
|
||||
return time.Time{}, newDecodeError(b[:1], "invalid timezone offset minutes")
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2683,11 +2683,11 @@ world'`,
|
||||
},
|
||||
{
|
||||
desc: `invalid zone offset hours`,
|
||||
data: `a=0000-01-01 00:00:00+25:00`,
|
||||
data: `a=0000-01-01 00:00:00+24:00`,
|
||||
},
|
||||
{
|
||||
desc: `invalid zone offset minutes`,
|
||||
data: `a=0000-01-01 00:00:00+00:61`,
|
||||
data: `a=0000-01-01 00:00:00+00:60`,
|
||||
},
|
||||
{
|
||||
desc: `invalid character in zone offset hours`,
|
||||
|
||||
Reference in New Issue
Block a user