Fix ValidateDateTime: check day instead month

Found with PVS-Studio static analyser, see 
https://www.viva64.com/en/b/0550/
pull/4147/head
Anton Fedorov 7 years ago committed by GitHub
parent a3868af12b
commit 473c5cff76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/google/protobuf/stubs/time.cc

@ -80,9 +80,9 @@ bool ValidateDateTime(const DateTime& time) {
return false;
}
if (time.month == 2 && IsLeapYear(time.year)) {
return time.month <= kDaysInMonth[time.month] + 1;
return time.day <= kDaysInMonth[time.month] + 1;
} else {
return time.month <= kDaysInMonth[time.month];
return time.day <= kDaysInMonth[time.month];
}
}

Loading…
Cancel
Save