mirror of
https://github.com/HowardHinnant/date.git
synced 2025-06-25 01:01:33 +02:00
Don't negate toff
if we've already failed
This avoids calling `-` on `not_a_offset`, which is set to `minutes::min()`, which is typically the min of `long`. Due to two's complement, calling `-` on this minimum value is undefined behavior.
This commit is contained in:
committed by
Howard Hinnant
parent
32ecb2ad24
commit
0b336657b1
@ -7577,7 +7577,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (neg)
|
||||
if (neg && !is.fail())
|
||||
toff = -toff;
|
||||
checked_set(temp_offset, toff, not_a_offset, is);
|
||||
command = nullptr;
|
||||
|
Reference in New Issue
Block a user