Comments (6)
Any reason why this fix hasn't been released yet (and affected versions yanked)? It's a known soundness issue in a popular crate.
from eyre.
Additional details:
- Mac M1 (macOS 14.2.1)
- Rust 1.74.1 (also tried on 1.74.0 and 1.73.0, same result)
from eyre.
I get the same segfault also on latest Manjaro Linux (x86-64), using Rust 1.74.1.
from eyre.
I've managed to simplify the reproduction case to remove dependencies (thiserror
and aws-sdk-ssm
are off the hook):
#![allow(dead_code)]
use std::{error::Error, fmt::Display};
use eyre::Context;
fn main() {
let err = trigger().unwrap_err();
let _ = err.downcast::<MyError>();
println!("it worked!");
}
#[derive(Debug)]
enum MyError {
ClientConstruction,
Other(String),
}
impl Display for MyError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "MyError error")
}
}
impl Error for MyError {}
fn trigger() -> eyre::Result<()> {
Err(MyError::ClientConstruction).wrap_err("failed")
}
The failure I get is slightly different (on a Mac M1 Sonoma 14.2) :
eyre_test(48377,0x1e194d000) malloc: *** error for object 0x1025c23ff: pointer being freed was not allocated
eyre_test(48377,0x1e194d000) malloc: *** set a breakpoint in malloc_error_break to debug
[Process exited 255]
Some things I've noticed:
- replacing the
Other
variant withOther(u32)
works fine. So doesOther
(empty variant). ButOther(Box<u32>)
fails - removing
.wrap_err()
(i.e returningErr(MyError::ClientConstruction.into())
intrigger()
) makes it work
from eyre.
Thank you for opening the issue.
I will look into it and see what may be causing it
from eyre.
I believe it is that the inner error is incorrectly freed even though it was downcasted, we still need to free the wrapped error.
The content of the Other
variant is likely because it gives the enum a Drop impl if any fields needs drop. Without it, the box deallocation will take shortcuts when freeing and not drop the contents, but just free
from eyre.
Related Issues (20)
- Extend `Option` with `ok_or_eyre`? HOT 2
- Improve discoverability of `OptionExt::ok_or_eyre` HOT 2
- Ergonomics: Hide `context` behind a feature HOT 4
- [breaking] remove alias exports `DefaultContext` and `EyreContext`
- [breaking] Remove `anyhow` from default features HOT 2
- `cargo doc` warning: "this URL is not a hyperlink"
- enable raw mode compatibility for panic & error reports HOT 1
- `fn Ok()` breaks all code with `use eyre::*` in new releases HOT 5
- `OptionExt` feature test is incorrectly feature-gated behind the `anyhow` flag
- [ BREAKING ] `ContextCompat` contains identically named methods to `WrapErr` which can be confusing and a footgun HOT 1
- [email protected] missing in the repository? HOT 2
- Eyre broken in rust-analyzer with nightly HOT 1
- and_then() that automatically converts error type to Report? HOT 11
- docs: enclosing in backticks HOT 1
- Implement From for anyhow errors
- New version of backtrace doesn't export `gimli-symbolize` anymore
- Path to 1.0
- DISCUSS: merge eyre and anyhow libraries HOT 1
- Add pre-hook callbacks HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eyre.