From 473c5cff764b879be1f4afefb71d6b8ba0b8a9d3 Mon Sep 17 00:00:00 2001 From: Anton Fedorov Date: Fri, 5 Jan 2018 22:09:44 +0100 Subject: Fix ValidateDateTime: check day instead month Found with PVS-Studio static analyser, see https://www.viva64.com/en/b/0550/ --- src/google/protobuf/stubs/time.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/stubs/time.cc b/src/google/protobuf/stubs/time.cc index 49c0412c..6def637e 100644 --- a/src/google/protobuf/stubs/time.cc +++ b/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]; } } -- cgit v1.2.3