Title: RUSTSEC-2026-0190: Unsoundness in `Error::downcast_mut()` · Issue #255 · uutils/diffutils · GitHub
Open Graph Title: RUSTSEC-2026-0190: Unsoundness in `Error::downcast_mut()` · Issue #255 · uutils/diffutils
X Title: RUSTSEC-2026-0190: Unsoundness in `Error::downcast_mut()` · Issue #255 · uutils/diffutils
Description: Unsoundness in Error::downcast_mut() Details Status unsound Package anyhow Version 1.0.102 URL dtolnay/anyhow#451 Date 2026-06-25 Affected versions of this crate violate borrow rules, resulting in undefined behavior, when the user adds c...
Open Graph Description: Unsoundness in Error::downcast_mut() Details Status unsound Package anyhow Version 1.0.102 URL dtolnay/anyhow#451 Date 2026-06-25 Affected versions of this crate violate borrow rules, resulting in ...
X Description: Unsoundness in Error::downcast_mut() Details Status unsound Package anyhow Version 1.0.102 URL dtolnay/anyhow#451 Date 2026-06-25 Affected versions of this crate violate borrow rules, resulting in ...
Opengraph URL: https://github.com/uutils/diffutils/issues/255
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RUSTSEC-2026-0190: Unsoundness in `Error::downcast_mut()`","articleBody":"\n\u003e Unsoundness in `Error::downcast_mut()`\n\n| Details | |\n| ------------------- | ---------------------------------------------- |\n| Status | unsound |\n| Package | `anyhow` |\n| Version | `1.0.102` |\n| URL | [https://github.com/dtolnay/anyhow/issues/451](https://github.com/dtolnay/anyhow/issues/451) |\n| Date | 2026-06-25 |\n\nAffected versions of this crate violate borrow rules, resulting in undefined behavior, when the user adds context to an error via `Error::context` and then later calls `Error::downcast_mut` on the returned `Error`.\n\nThe flaw was corrected in commit `6e8c000` by revising how the mutable reference is constructed, avoiding inclusion of a shared reference in the resulting borrow chain.\n\n## Example\n\n```rust\nuse anyhow::Error;\nuse std::fmt;\n\n#[derive(Debug)]\nstruct ErrorContext(\u0026amp;\u0026#39;static str);\n\nimpl fmt::Display for ErrorContext {\n fn fmt(\u0026amp;self, f: \u0026amp;mut fmt::Formatter\u0026lt;\u0026#39;_\u0026gt;) -\u0026gt; fmt::Result {\n fmt::Display::fmt(\u0026amp;self.0, f)\n }\n}\n\nfn main() {\n let mut error = Error::msg(\u0026quot;inner error\u0026quot;).context(ErrorContext(\u0026quot;old context\u0026quot;));\n let context: \u0026amp;mut ErrorContext = error.downcast_mut().unwrap();\n context.0 = \u0026quot;new context\u0026quot;;\n println!(\u0026quot;{:?}\u0026quot;, error);\n}\n```\n\n## Miri output\n\n```\nerror: Undefined Behavior: trying to retag from \u0026lt;1538\u0026gt; for Unique permission at alloc602[0x38], but that tag only grants SharedReadOnly permission for this location\n --\u0026gt; src/ptr.rs:170:18\n |\n170 | unsafe { \u0026amp;mut *self.ptr.as_ptr() }\n | ^^^^^^^^^^^^^^^^^^^^^^^ this error occurs as part of retag at alloc602[0x38..0x48]\n |\n = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental\n = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information\nhelp: \u0026lt;1538\u0026gt; was created by a SharedReadOnly retag at offsets [0x38..0x48]\n --\u0026gt; src/ptr.rs:89:18\n |\n 89 | ptr: NonNull::from(ptr),\n | ^^^^^^^^^^^^^^^^^^\n = note: stack backtrace:\n 0: anyhow::ptr::Mut::\u0026lt;\u0026#39;_, ErrorContext\u0026gt;::deref_mut\n at src/ptr.rs:170:18: 170:41\n 1: anyhow::error::\u0026lt;impl anyhow::Error\u0026gt;::downcast_mut::\u0026lt;ErrorContext\u0026gt;\n at src/error.rs:560:18: 560:46\n 2: main\n at examples/downcast_mut.rs:15:38: 15:58\n```\n\nSee [advisory page](https://rustsec.org/advisories/RUSTSEC-2026-0190.html) for additional details.\n","author":{"url":"https://github.com/github-actions[bot]","@type":"Person","name":"github-actions[bot]"},"datePublished":"2026-06-30T00:34:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/255/diffutils/issues/255"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4c8265d1-5188-309b-c6d1-2d36c8c47726 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C6A0:B577:14CF5CD:1CC1661:6A4DED41 |
| html-safe-nonce | 52fbeb620201dd4dbfd8a9d6aa010042eee3ffae86da78eb070c32e59b939a34 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkEwOkI1Nzc6MTRDRjVDRDoxQ0MxNjYxOjZBNERFRDQxIiwidmlzaXRvcl9pZCI6IjMxNTY0NzcyOTU2MDgwNjUzNDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9b01dd727af209c206429aa3f64c50e497e9852f4e917cf1d6e176f8f2609636 |
| hovercard-subject-tag | issue:4772636059 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/uutils/diffutils/255/issue_layout |
| twitter:image | https://opengraph.githubassets.com/09cfbddb46f1755cf8a1d65a8f87e5eba11bc79b64e77a3f6ad7d6cf78cd0731/uutils/diffutils/issues/255 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/09cfbddb46f1755cf8a1d65a8f87e5eba11bc79b64e77a3f6ad7d6cf78cd0731/uutils/diffutils/issues/255 |
| og:image:alt | Unsoundness in Error::downcast_mut() Details Status unsound Package anyhow Version 1.0.102 URL dtolnay/anyhow#451 Date 2026-06-25 Affected versions of this crate violate borrow rules, resulting in ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | github-actions[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5818716c93c6a2925b815402541a32814e43a7b1261c322b0c2df75224289566 |
| turbo-cache-control | no-preview |
| go-import | github.com/uutils/diffutils git https://github.com/uutils/diffutils.git |
| octolytics-dimension-user_id | 5148717 |
| octolytics-dimension-user_login | uutils |
| octolytics-dimension-repository_id | 341787720 |
| octolytics-dimension-repository_nwo | uutils/diffutils |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 341787720 |
| octolytics-dimension-repository_network_root_nwo | uutils/diffutils |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f4bb89367ca678f057d79b1abc45d6675b1bd5b2 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width