Update Rust crate time to 0.2.23 [SECURITY] #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.1.42
->0.2.23
GitHub Vulnerability Alerts
CVE-2020-26235
Impact
Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.
The affected functions from time 0.2.7 through 0.2.22 are:
time::UtcOffset::local_offset_at
time::UtcOffset::try_local_offset_at
time::UtcOffset::current_local_offset
time::UtcOffset::try_current_local_offset
time::OffsetDateTime::now_local
time::OffsetDateTime::try_now_local
The affected functions in time 0.1 (all versions) are:
at
at_utc
now
Non-Unix targets (including Windows and wasm) are unaffected.
Patches
In some versions of
time
, the internal method that determines the local offset has been modified to always returnNone
on the affected operating systems. This has the effect of returning anErr
on thetry_*
methods andUTC
on the non-try_*
methods. In later versions,time
will attempt to determine the number of threads running in the process. If the process is single-threaded, the call will proceed as its safety invariant is upheld.Users and library authors with time in their dependency tree must perform
cargo update
, which will pull in the updated, unaffected code.Users of time 0.1 do not have a patch and must upgrade to an unaffected version: time 0.2.23 or greater or the 0.3 series.
Workarounds
Library authors must ensure that the program only has one running thread at the time of calling any affected method. Binary authors may do the same and/or ensure that no other thread is actively mutating the environment.
References
time-rs/time#293.
Release Notes
time-rs/time (time)
v0.2.23
Compare Source
Compatibility notes
Due to #293, any method that requires knowledge of the local offset will now
fail on Linux. For
try_
methods, this means returning an error. For others,it means assuming UTC.
Deprecated
UtcOffset::timestamp
(moved toUtcOffset::unix_timestamp
)UtcOffset::timestamp_nanos
(moved toUtcOffset::unix_timestamp_nanos
)date
(moved tomacros::date
)time
(moved tomacros::time
)offset
(moved tomacros::offset
)OffsetDateTime::now_local
(assumes UTC if unable to be determined)UtcOffset::local_offset_at
(assumes UTC if unable to be determined)UtcOffset::current_local_offset
(assumes UTC if unable to be determined)v0.2.22
Compare Source
Fixed
Duration::new
could previously result in an inconsistent internal state. This led to some oddsituations where a
Duration
could be both positive and negative. This has been fixed such thatthe internal state maintains its invariants.
v0.2.21
Compare Source
Changed
component being out of range can be directly obtained, while an invalid offset or conversion error
is guaranteed to be a zero-sized type.
const fn
on rustc ≥ 1.46:Date::try_from_iso_ywd
Date::iso_year_week
Date::week
Date::sunday_based_week
Date::monday_based_week
Date::try_with_hms
Date::try_with_hms_milli
Date::try_with_hms_micro
Date::try_with_hms_nano
PrimitiveDateTime::iso_year_week
PrimitiveDateTime::week
PrimitiveDateTime::sunday_based_week
PrimitiveDateTime::monday_based_week
util::weeks_in_year
v0.2.20
Compare Source
Added
OffsetDateTime::timestamp_nanos
OffsetDateTime::from_unix_timestamp_nanos
Fixed
A bug with far-reaching consequences has been fixed. See #276 for complete details, but the gist is
that the constructing a
Date
from a valid Julian day may result in an invalid value or even panic.As a consequence of implementation details, this affects nearly all arithmetic with
Date
s (and asa result also
PrimitiveDateTime
s andOffsetDateTime
s).Improvements
OffsetDateTime
from a timestamp-nanosecond pairv0.2.19
Compare Source
Fixed
COMPILING_UNDER_CARGO_WEB
environmentvariable.
%D
specifier no longer requires padding on the month. Previously,Err(InvalidMonth)
was incorrectly returned.std::time::Duration
that is larger thantime::Duration::max_value()
now correctly returnsOrdering::Greater
when compared.Sign::Zero
now sets the integer to be zero. Thispreviously left the integer unmodified.
v0.2.18
Compare Source
Changed
const fn
on rustc ≥ 1.46:Date::try_from_ymd
Date::try_from_yo
Time::try_from_hms
Time::try_from_hms_milli
Time::try_from_hms_micro
Time::try_from_hms_nano
error
module has been created where all existing error types are contained. TheError
suffix has been dropped from these types.
ext
module has been created where extension traits are contained.util
module has been created where utility functions are contained.error::ComponentRange
now implementsCopy
.For back-compatibility, all items that were moved to newly-contained modules have been re-exported
from their previous locations (and in the case of the
error
module, with their previous name).Fixes
Parsing
format::Rfc3339
now correctly handles the UTC offset (#274).v0.2.17
Compare Source
Changed
The following functions are
const fn
on rustc ≥ 1.46:Date::year
Date::month
Date::day
Date::month_day
Date::ordinal
Date::as_ymd
Date::as_yo
Date::julian_day
Duration::checked_div
PrimitiveDateTime::year
PrimitiveDateTime::month
PrimitiveDateTime::day
PrimitiveDateTime::month_day
PrimitiveDateTime::ordinal
Weekday::previous
Weekday::next
Improvements
size_of::<Date>()
has been reduced from 8 to 4. As a consequence,size_of::<PrimitiveDatetime>()
went from 16 to 12 andsize_of::<OffsetDateTime>()
from 20to 16. This change also results in a performance improvement of approximately 30% on the
Date::year
andDate::ordinal
methods.cfg-if
has been removed as a dependency.Fixed
cfg
flags passed to rustc will no longer collide with other crates (at least unless they'redoing something very stupid).
combinations would fail.
v0.2.16
Compare Source
Added
OffsetDateTime
s can now be represented as Unix timestamps with serde. To do this, you can use thetime::serde::timestamp
andtime::serde::timestamp::option
modules.v0.2.15
Compare Source
Fixed
cargo-web
support works, and is now explicitly checked in CI. A previous change was made that madea method call ambiguous.
v0.2.14
Compare Source
Fixed
Adding/subtracting a
core::time::Duration
now correctly takes subsecond values into account. Thisalso affects
PrimitiveDateTime
andOffsetDateTime
.v0.2.13
Compare Source
Fixed
Panicking APIs are re-exposed.
v0.2.12
Compare Source
Fixed
Subtracting
Instant
s can correctly result in a negative duration, rather than resulting in theabsolute value of it.
v0.2.11
Compare Source
Added
OffsetDateTime::now_utc
Deprecated
OffsetDateTime::now
due to the offset not being clear from the method name alone.Fixed
Date
s are now uniformly random when using therand
crate. Previously, both the year and daywithin the year were uniform, but this meant that any given day in a leap year was slightly less
likely to be chosen than a day in a non-leap year.
Changed
v0.2.10
Compare Source
Added
OffsetDateTime
s as RFC3339.impl Display
,rather than a concrete type.
Fixed
v0.2.9
Compare Source
Added
OffsetDateTime
s as RFC3339.impl Display
,rather than a concrete type.
Fixed
v0.2.8
Compare Source
Added
cargo_web
support has been added for getting a local offset. A general catch-all defaulting toUTC has also been added.
Error::source
has been implemented for the wrappertime::Error
.UtcOffset::try_local_offset
,UtcOffset::try_current_local_offset
,OffsetDateTime::try_now_local()
provide fallible alternatives when the default of UTC is notdesired. To facilitate this change,
IndeterminateOffsetError
has been added.Changed
#[non_exhaustive]
is simulated on compilers prior to 1.40.0.v0.2.7
Compare Source
Added
Display
has been implemented forDate
,OffsetDateTime
,PrimitiveDateTime
,Time
,UtcOffset
, andWeekday
.Hash
is now derived forDuration
.SystemTime
can be converted to and fromOffsetDateTime
. The following trait implementationshave been made for interoperability:
impl Sub<SystemTime> for OffsetDateTime
impl Sub<OffsetDateTime> for SystemTime
impl PartialEq<SystemTime> for OffsetDateTime
impl PartialEq<OffsetDateTime> for SystemTime
impl PartialOrd<SystemTime> for OffsetDateTime
impl PartialOrd<OffsetDateTime> for SystemTime
impl From<SystemTime> for OffsetDateTime
impl From<OffsetDateTime> for SystemTime
impl Duration<T> for Standard
, allowing usage with therand
crate. This isgated behind the
rand
feature flag.NumericalDuration
has been implemented forf32
andf64
.NumericalStdDuration
andNumericalStdDurationShort
have been implemented forf64
only.UtcOffset::local_offset_at(OffsetDateTime)
, which will obtain the system's local offset at theprovided moment in time.
OffsetDateTime::now_local()
is equivalent to callingOffsetDateTime::now().to_offset(UtcOffset::local_offset_at(OffsetDateTime::now()))
(but moreefficient).
UtcOffset::current_local_offset()
will return the equivalent ofOffsetDateTime::now_local().offset()
.Changed
impl AsRef<str>
as parameters, rather than just&str
.time::validate_format_string
does this as well.Date
being between the years -100,000 and +100,000 (inclusive) is nowstrictly enforced.
Duration
are now enabled by default. This behavior is the identical to whatthe standard library does.
time
,date
, andoffset
macros have been added to the prelude.Deprecated
Sign
has been deprecated in its entirety, along withDuration::sign
.To obtain the sign of a
Duration
, you can use theDuration::is_positive
,Duration::is_negative
, andDuration::is_zero
methods.A number of functions and trait implementations that implicitly assumed a timezone (generally UTC)
have been deprecated. These are:
Date::today
Time::now
PrimitiveDateTime::now
PrimitiveDateTime::unix_epoch
PrimitiveDateTime::from_unix_timestamp
PrimitiveDateTime::timestamp
impl Sub<SystemTime> for PrimitiveDateTime
impl Sub<PrimitiveDateTime> for SystemTime
impl PartialEq<SystemTime> for PrimitiveDateTime
impl PartialEq<PrimitiveDateTime> for SystemTime>
impl PartialOrd<SystemTime> for PrimitiveDateTime
impl PartialOrd<PrimitiveDateTime> for SystemTime>
impl From<SystemTime> for PrimitiveDateTime
impl From<PrimitiveDateTime> for SystemTime
Fixed
Duration
is now always in range. Previously, it was possible (viaaddition and/or subtraction) to obtain a value that was not internally consistent.
Time::parse
erroneously returned anInvalidMinute
error when it was actually the second thatwas invalid.
Date::parse("0000-01-01", "%Y-%m-%d")
incorrectly returned anErr
(#221).v0.2.6
Compare Source
Bug fixes
v0.2.5 introduces a major inconsistency, not just in its behavior for
PrimitiveDateTime::using_offset
, but also changes its signature, rendering it incapable of being used inconst
contexts.Both the behavior and the function signature have been fixed, while still fixing the underlying issue.
PrimitiveDateTime::using_offset
mentions in the docs that thePrimitiveDateTime
is assumed to be UTC, and is converted to the provided offset. This was the previous behavior.The following functionality had bugs that were fixed (from v0.2.4):
OffsetDateTime::timestamp
OffsetDateTime::parse
OffsetDateTime
— Subsecond values were not checked previously. They also relied on the faulty timestamp implementation.OffsetDateTime
— Same as equality and comparison. Additionally, hashes would collide withPrimitiveDateTime
if the underlying UTC was the same.OffsetDateTime
s previously disregarded the subsecond values.All of these changes are now checked in CI, so regressions will be caught.
v0.2.5
Compare Source
Bug fixes
PrimitiveDateTime::using_offset
was poorly defined, leading to an ambiguity that cause some methods to treat the existing datetime as UTC, while others treated it as the time in the provided offset. This release ensures that the behavior is what I intended — the datetime is assumed to be in the provided offset.NB: This release has been yanked from crates.io due to major back-compatibility issues. These have been fixed in 0.2.6.
v0.2.4
Compare Source
v0.2.4 is identical to v0.2.3 with the exception of the breaking change, which has been reverted. v0.2.4 is backwards-compatible with v0.2.2.
v0.2.3
Compare Source
v0.2.3 has been yanked from crates.io. The breaking change (with regard to feature flags) should not have been made. By yanking this version, any existing code will continue to work, while new code will not have potential backwards-incompatible behavior. The change was reverted in v0.2.4.
Additions
time!
,date!
,offset!
macrosparse
function, allowing for type inference.time::Result<T>
alias totime::Result<T, time::Error>
Deprecated
Panicking APIs have been deprecated in favor of the new macros.
Changes
Minimum supported Rust version is now 1.34, changed from 1.40. This permits a number of crates to upgrade without breaking MSRV.
Bug fixes
A number of parsing methods used unchecked constructors. This was because the values should have been checked prior. They are now.
Breaking changes
The "std" feature has been renamed to "alloc", which disables the standard library. This was necessary to bring MSRV down to 1.34.
v0.2.2
Compare Source
Fixed
v0.2.1
Compare Source
Fixed
COMPILING_UNDER_CARGO_WEB
environmentvariable.
%D
specifier no longer requires padding on the month. Previously,Err(InvalidMonth)
was incorrectly returned.std::time::Duration
that is larger thantime::Duration::max_value()
now correctly returnsOrdering::Greater
when compared.Sign::Zero
now sets the integer to be zero. Thispreviously left the integer unmodified.
v0.2.0
See #190 for major details. This is essentially a new crate compared to v0.1, and only has a few methods for back-compatibility where trivially feasible.
Minimum supported Rust version: 1.40.0
v0.1.44
Compare Source
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.