-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Labels
CVE-2020-26235Unsound behaviour with local timezone accessUnsound behaviour with local timezone access
Description
The following (MWE) test has regressed to an unexpected failure upon upgrade from v1.15.0 to v1.15.1.
#[test]
fn foo() {
simple_logger::SimpleLogger::new().init().unwrap();
log::error!("asdf");
}
The new error upon upgrade is:
---- foo stdout ----
thread 'foo' panicked at 'Could not determine the UTC offset on this system. Possible causes are that the time crate does not implement "local_offset_at" on your system, or that you are running in a multi-threaded environment and the time crate is returning "None" from "local_offset_at" to avoid unsafe behaviour. See the time crate's documentation for more information. (https://time-rs.github.io/internal-api/time/index.html#feature-flags): IndeterminateOffset', /home/kristofer/.cargo/registry/src/github.com-1ecc6299db9ec823/simple_logger-1.15.1/src/lib.rs:360:64
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This does not happen when the same code is put into src/main.rs
and run via cargo run
. It seems to just be when running in a test suite. (I discovered this in one of my tests/*.rs
files on a recent CI run.)
I am running Linux 5.15.4-arch1-1, cargo and rustc 1.57.0 (latest). The same crash also happens in an ubuntu-20.04
GitHub Actions environment.
📝 A successful test on log = 0.4.14 and simple_logger = 1.15.0:
~/crash > cat Cargo.toml
[package]
name = "crash"
version = "0.1.0"
edition = "2021"
[dependencies]
log = "=0.4.14"
simple_logger = "=1.15.0"
~/crash > cargo clean; cargo +stable test
Compiling libc v0.2.111
Compiling log v0.4.14
Compiling cfg-if v1.0.0
Compiling itoa v0.4.8
Compiling time-macros v0.2.3
Compiling lazy_static v1.4.0
Compiling atty v0.2.14
Compiling colored v1.9.3
Compiling time v0.3.5
Compiling simple_logger v1.15.0
Compiling crash v0.1.0 (~/crash)
Finished test [unoptimized + debuginfo] target(s) in 1.92s
Running unittests (target/debug/deps/crash-1fa0a31e9a43fbdf)
running 1 test
test foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests (target/debug/deps/crash-44d68fedfb08f7e9)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests crash
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
📝 The exact same test, but replacing =1.15.0
with =1.15.1
in Cargo.toml
:
~/crash > cat Cargo.toml
[package]
name = "crash"
version = "0.1.0"
edition = "2021"
[dependencies]
log = "=0.4.14"
simple_logger = "=1.15.1"
~/crash > cargo clean; cargo +stable test
Compiling libc v0.2.111
Compiling log v0.4.14
Compiling time-macros v0.2.3
Compiling itoa v0.4.8
Compiling cfg-if v1.0.0
Compiling lazy_static v1.4.0
Compiling atty v0.2.14
Compiling colored v1.9.3
Compiling time v0.3.5
Compiling simple_logger v1.15.1
Compiling crash v0.1.0 (~/crash)
Finished test [unoptimized + debuginfo] target(s) in 1.98s
Running unittests (target/debug/deps/crash-c4caeb7678a19db2)
running 1 test
test foo ... FAILED
failures:
---- foo stdout ----
thread 'foo' panicked at 'Could not determine the UTC offset on this system. Possible causes are that the time crate does not implement "local_offset_at" on your system, or that you are running in a multi-threaded environment and the time crate is returning "None" from "local_offset_at" to avoid unsafe behaviour. See the time crate's documentation for more information. (https://time-rs.github.io/internal-api/time/index.html#feature-flags): IndeterminateOffset', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/simple_logger-1.15.1/src/lib.rs:360:64
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
foo
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
error: test failed, to rerun pass '--lib'
Mdrbhatti
Metadata
Metadata
Assignees
Labels
CVE-2020-26235Unsound behaviour with local timezone accessUnsound behaviour with local timezone access