Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miri reporting UB #9

Open
muja opened this issue Jul 24, 2023 · 1 comment · May be fixed by #10
Open

miri reporting UB #9

muja opened this issue Jul 24, 2023 · 1 comment · May be fixed by #10

Comments

@muja
Copy link

muja commented Jul 24, 2023

When trying to run my program with miri, it reports UB, however with the note that "the Stacked Borrows rules it violated are still experimental". This minimal example UBs according to miri. I don't know how to make it more minimal unfortunately without investing too much time into it. I'm not using circular directly, it's a transitive dependency through rc-zip.

use rc_zip::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let f = &include_bytes!("../tests/data/Test.docx")[..];
    let a = f.read_zip_with_size(f.len() as u64).unwrap();
    let entry = a.by_name("word/document.xml").unwrap();
    let mut doc = xml::EventReader::new(entry.reader());
    let _ = doc.next();
    Ok(())
}

Cargo.toml:

[package]
name = "ziptest"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rc-zip = "2.0.1"
xml-rs = "0.8.16"

Is this a valid concern or a false positive?

Test.docx (but any Word document should do I guess)

Output:

image

Full output: output.txt

@muja
Copy link
Author

muja commented Jul 24, 2023

Running the test suite of this crate with miri also produces errors:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant