zeroize: possible UB in `Zeroize` implementation for `Option<T>`
還沒有人認領這個 Issue。
評估
研究方向
從 zeroize/src/lib.rs 約第 330 行開始,使用連結的 Rust Playground 或 Miri 範例重現回報的行為。確定 Option 實作的健全方法,並驗證所得的行為不再觸發回報的未定義行為錯誤。
由索引模型根據 Issue 內容生成。
描述
Originally filed by @jessa0 as https://github.com/iqlusioninc/crates/issues/782:
It seems the
Zeroizeimplementation forOption<T> where T: Zeroizehas language-level UB here:I believe, as a
repr(Rust)enum, the memory layout and set of valid bit-patterns forOptionis not defined, and that setting an enum's storage to an invalid bit-pattern while a reference to it exists, even if the value is never read, is instant language-level UB. The documentation forOptiondoes mention guarantees for several special cases, but theNonecase still isn't defined for many of those cases, and theZeroizeimplementation is more generic than that. Here's an example of a miri error in such a situation, that scottmcm came up with on URLO here.
- 主要語言
- Rust
- 星號
- 674
- 分支
- 170
- 平均合併
- 1 天 12 小時
- 30 天內合併 PR
- 10
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
RustCrypto/utils 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
RustCrypto/utils#1546 · 1 則留言 ·
-
難度 3/5 1-2 天 新手友好度 55/100
RustCrypto/utils#1537 · 7 則留言 ·
-
難度 4/5 3-5 天 新手友好度 45/100
RustCrypto/utils#1534 · 2 則留言 ·
-
難度 5/5 一週以上 新手友好度 45/100
RustCrypto/utils#1529 · 4 則留言 ·
-
難度 4/5 3-5 天 新手友好度 45/100
RustCrypto/utils#1510 · 1 則留言 ·
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
-
bug core
難度 2/5 1-3 小時 新手友好度 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW 未關閉fuzz
難度 2/5 1-3 小時 新手友好度 82/100
ClickHouse/ClickHouse#122114 ·
-
難度 1/5 1 小時以內 新手友好度 92/100
linebender/vello_svg#90 ·
-
難度 2/5 1-3 小時 新手友好度 74/100