2
0
mirror of https://github.com/boostorg/mysql.git synced 2026-02-17 01:42:17 +00:00

Fixed overflow bug for DATETIMES

In text deserialization, for 32 bit systems
This commit is contained in:
ruben
2020-05-12 10:27:17 +01:00
parent ee4b4e8422
commit 90ca918308

View File

@@ -214,14 +214,13 @@ inline errc deserialize_text_value_datetime(
if (is_out_of_range(d))
return errc::protocol_value_error;
// Sum it up
to = datetime(
d +
// Sum it up. Doing time of day independently to prevent overflow
auto time_of_day =
std::chrono::hours(hours) +
std::chrono::minutes(minutes) +
std::chrono::seconds(seconds) +
std::chrono::microseconds(micros)
);
std::chrono::microseconds(micros);
to = d + time_of_day;
return errc::ok;
}