Update Rust crate time to 0.2.23 [SECURITY] - #71
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.23Segmentation fault in time
CVE-2020-26235 / GHSA-wcg3-cvx6-7396
More information
Details
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_attime::UtcOffset::try_local_offset_attime::UtcOffset::current_local_offsettime::UtcOffset::try_current_local_offsettime::OffsetDateTime::now_localtime::OffsetDateTime::try_now_localThe affected functions in time 0.1 (all versions) are:
atat_utcnowNon-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 returnNoneon the affected operating systems. This has the effect of returning anErron thetry_*methods andUTCon the non-try_*methods. In later versions,timewill 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.
Severity
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
time-rs/time (time)
v0.2.23Compare 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.22Compare Source
Fixed
Duration::newcould previously result in an inconsistent internal state. This led to some oddsituations where a
Durationcould be both positive and negative. This has been fixed such thatthe internal state maintains its invariants.
v0.2.21Compare 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 fnon rustc ≥ 1.46:Date::try_from_iso_ywdDate::iso_year_weekDate::weekDate::sunday_based_weekDate::monday_based_weekDate::try_with_hmsDate::try_with_hms_milliDate::try_with_hms_microDate::try_with_hms_nanoPrimitiveDateTime::iso_year_weekPrimitiveDateTime::weekPrimitiveDateTime::sunday_based_weekPrimitiveDateTime::monday_based_weekutil::weeks_in_yearv0.2.20Compare Source
Added
OffsetDateTime::timestamp_nanosOffsetDateTime::from_unix_timestamp_nanosFixed
A bug with far-reaching consequences has been fixed. See #276 for complete details, but the gist is
that the constructing a
Datefrom 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
Dates (and asa result also
PrimitiveDateTimes andOffsetDateTimes).Improvements
OffsetDateTimefrom a timestamp-nanosecond pairv0.2.19Compare Source
Fixed
COMPILING_UNDER_CARGO_WEBenvironmentvariable.
%Dspecifier no longer requires padding on the month. Previously,Err(InvalidMonth)was incorrectly returned.std::time::Durationthat is larger thantime::Duration::max_value()now correctly returnsOrdering::Greaterwhen compared.Sign::Zeronow sets the integer to be zero. Thispreviously left the integer unmodified.
v0.2.18Compare Source
Changed
const fnon rustc ≥ 1.46:Date::try_from_ymdDate::try_from_yoTime::try_from_hmsTime::try_from_hms_milliTime::try_from_hms_microTime::try_from_hms_nanoerrormodule has been created where all existing error types are contained. TheErrorsuffix has been dropped from these types.
extmodule has been created where extension traits are contained.utilmodule has been created where utility functions are contained.error::ComponentRangenow 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
errormodule, with their previous name).Fixes
Parsing
format::Rfc3339now correctly handles the UTC offset (#274).v0.2.17Compare Source
Changed
The following functions are
const fnon rustc ≥ 1.46:Date::yearDate::monthDate::dayDate::month_dayDate::ordinalDate::as_ymdDate::as_yoDate::julian_dayDuration::checked_divPrimitiveDateTime::yearPrimitiveDateTime::monthPrimitiveDateTime::dayPrimitiveDateTime::month_dayPrimitiveDateTime::ordinalWeekday::previousWeekday::nextImprovements
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::yearandDate::ordinalmethods.cfg-ifhas been removed as a dependency.Fixed
cfgflags passed to rustc will no longer collide with other crates (at least unless they'redoing something very stupid).
combinations would fail.
v0.2.16Compare Source
Added
OffsetDateTimes can now be represented as Unix timestamps with serde. To do this, you can use thetime::serde::timestampandtime::serde::timestamp::optionmodules.v0.2.15Compare Source
Fixed
cargo-websupport works, and is now explicitly checked in CI. A previous change was made that madea method call ambiguous.
v0.2.14Compare Source
Fixed
Adding/subtracting a
core::time::Durationnow correctly takes subsecond values into account. Thisalso affects
PrimitiveDateTimeandOffsetDateTime.v0.2.13Compare Source
Fixed
Panicking APIs are re-exposed.
v0.2.12Compare Source
Fixed
Subtracting
Instants can correctly result in a negative duration, rather than resulting in theabsolute value of it.
v0.2.11Compare Source
Added
OffsetDateTime::now_utcDeprecated
OffsetDateTime::nowdue to the offset not being clear from the method name alone.Fixed
Dates are now uniformly random when using therandcrate. 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.10Compare Source
Added
OffsetDateTimes as RFC3339.impl Display,rather than a concrete type.
Fixed
v0.2.9Compare Source
Added
OffsetDateTimes as RFC3339.impl Display,rather than a concrete type.
Fixed
v0.2.8Compare Source
Added
cargo_websupport has been added for getting a local offset. A general catch-all defaulting toUTC has also been added.
Error::sourcehas 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,
IndeterminateOffsetErrorhas been added.Changed
#[non_exhaustive]is simulated on compilers prior to 1.40.0.v0.2.7Compare Source
Added
Displayhas been implemented forDate,OffsetDateTime,PrimitiveDateTime,Time,UtcOffset, andWeekday.Hashis now derived forDuration.SystemTimecan be converted to and fromOffsetDateTime. The following trait implementationshave been made for interoperability:
impl Sub<SystemTime> for OffsetDateTimeimpl Sub<OffsetDateTime> for SystemTimeimpl PartialEq<SystemTime> for OffsetDateTimeimpl PartialEq<OffsetDateTime> for SystemTimeimpl PartialOrd<SystemTime> for OffsetDateTimeimpl PartialOrd<OffsetDateTime> for SystemTimeimpl From<SystemTime> for OffsetDateTimeimpl From<OffsetDateTime> for SystemTimeimpl Duration<T> for Standard, allowing usage with therandcrate. This isgated behind the
randfeature flag.NumericalDurationhas been implemented forf32andf64.NumericalStdDurationandNumericalStdDurationShorthave been implemented forf64only.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_stringdoes this as well.Datebeing between the years -100,000 and +100,000 (inclusive) is nowstrictly enforced.
Durationare now enabled by default. This behavior is the identical to whatthe standard library does.
time,date, andoffsetmacros have been added to the prelude.Deprecated
Signhas 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_zeromethods.A number of functions and trait implementations that implicitly assumed a timezone (generally UTC)
have been deprecated. These are:
Date::todayTime::nowPrimitiveDateTime::nowPrimitiveDateTime::unix_epochPrimitiveDateTime::from_unix_timestampPrimitiveDateTime::timestampimpl Sub<SystemTime> for PrimitiveDateTimeimpl Sub<PrimitiveDateTime> for SystemTimeimpl PartialEq<SystemTime> for PrimitiveDateTimeimpl PartialEq<PrimitiveDateTime> for SystemTime>impl PartialOrd<SystemTime> for PrimitiveDateTimeimpl PartialOrd<PrimitiveDateTime> for SystemTime>impl From<SystemTime> for PrimitiveDateTimeimpl From<PrimitiveDateTime> for SystemTimeFixed
Durationis now always in range. Previously, it was possible (viaaddition and/or subtraction) to obtain a value that was not internally consistent.
Time::parseerroneously returned anInvalidMinuteerror when it was actually the second thatwas invalid.
Date::parse("0000-01-01", "%Y-%m-%d")incorrectly returned anErr(#221).v0.2.6Compare 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 inconstcontexts.Both the behavior and the function signature have been fixed, while still fixing the underlying issue.
PrimitiveDateTime::using_offsetmentions in the docs that thePrimitiveDateTimeis 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::timestampOffsetDateTime::parseOffsetDateTime— Subsecond values were not checked previously. They also relied on the faulty timestamp implementation.OffsetDateTime— Same as equality and comparison. Additionally, hashes would collide withPrimitiveDateTimeif the underlying UTC was the same.OffsetDateTimes previously disregarded the subsecond values.All of these changes are now checked in CI, so regressions will be caught.
v0.2.5Compare Source
Bug fixes
PrimitiveDateTime::using_offsetwas 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.4Compare 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.3Compare 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!macrosparsefunction, 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.2Compare Source
Fixed
v0.2.1Compare Source
Fixed
COMPILING_UNDER_CARGO_WEBenvironmentvariable.
%Dspecifier no longer requires padding on the month. Previously,Err(InvalidMonth)was incorrectly returned.std::time::Durationthat is larger thantime::Duration::max_value()now correctly returnsOrdering::Greaterwhen compared.Sign::Zeronow sets the integer to be zero. Thispreviously left the integer unmodified.
v0.2.0See #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.44Compare Source
Configuration
📅 Schedule: (UTC)
🚦 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.